#include main() { int arr[ ]={30,25,20,15,10,5}, *p=arr; p++; printf(“%d\n”,*(p+3)); }
举一反三
- 预测下面程序的输出:// PROGRAM 1#include <stdio.h>int main(void){ int arr[] = {10, 20}; int *p = arr; ++*p; printf("arr[0] = %d, arr[1] = %d, *p = %d", arr[0], arr[1], *p); return 0;}// PROGRAM 2#include <stdio.h>int main(void){ int arr[] = {10, 20}; int *p = arr; *p++; printf("arr[0] = %d, arr[1] = %d, *p = %d", arr[0], arr[1], *p); return 0;}// PROGRAM 3#include <stdio.h>int main(void){ int arr[] = {10, 20}; int *p = arr; *++p; printf("arr[0] = %d, arr[1] = %d, *p = %d", arr[0], arr[1], *p); return 0;}
- 有以下程序 #include<stdio.h> voidf(int*p); main() {inta[5]={1,2,3,4,5},*r=a; f(r);printf(”%d\n”;*r); } voidf(int*p) {p=p+3;printf(”%d,”,*p);}
- 下列程序的运行结果是( )。 #include int main() { int a[5]={1,2,3,4,5},*p,**pp; p=a; pp=&p; printf("%d ",*(p+3)); printf("%d",**pp); return 0; }
- 下面程序的输出结果应该是(). main() {int a[5]={2,4,6,8,10},*p,**k; p=a; k=&p; printf("%d",*(p++)); printf("%d\n",**k); }
- 有以下程序段,输出结果为()。 #include<stdio.h> main() { int a[10]={5,10,15,20,25,30,35,40,45,50}; int *p=a; int *s, m; s=p++; m=*p++; printf(“%d,%d,%d , *p, *s, m); }