有以下程序段:#include stdio.hint main(){int x[ ] = {10, 20, 30}; int *px = x;printf(%d, , ++*px); printf(%d, , *px); px = x;printf(%d, , (*px)++); printf(%d, , *px); px = x;printf(%d, , *px++); printf(%d, , *px); px = x;printf(%d, , *++px); printf(%d\n, *px);return 0;}程序运行后的输出结果是( )。
A: 11, 11, 11, 12, 12, 20, 20, 20
B: 20, 10, 11, 10, 11, 10, 11, 10
C: 11, 11, 11, 12, 12, 13, 20, 20
D: 20, 10, 11, 20, 11, 12, 20, 20
A: 11, 11, 11, 12, 12, 20, 20, 20
B: 20, 10, 11, 10, 11, 10, 11, 10
C: 11, 11, 11, 12, 12, 13, 20, 20
D: 20, 10, 11, 20, 11, 12, 20, 20
举一反三
- 有以下程序段:#include int main(){int x[ ] = {10, 20, 30}; int *px = x;printf("%d, ", ++*px); printf("%d, ", *px); px = x;printf("%d, ", (*px)++); printf("%d, ", *px); px = x;printf("%d, ", *px++); printf("%d, ", *px); px = x;printf("%d, ", *++px); printf("%d\n", *px);return 0;}程序运行后的输出结果是( ) A: 20, 10, 11, 10, 11, 10, 11, 10 B: 11, 11, 11, 12, 12, 20, 20, 20 C: 20, 10, 11, 20, 11, 12, 20, 20 D: 11, 11, 11, 12, 12, 13, 20, 20
- 写出下列程序运行结果 #include “stdio.h” void swap(int *px , int *py ); void main() { int a,b; a=5; b=10; printf(“ before swap a=%d, b=%d ”,a,b); swap(&a,&b); printf(“after swap a=%d, b=%d ”,a,b); } voidswap(int *px , int *py ) { int temp; temp=*px; *px=* py; *py=temp; printf(“ in swap x=%d,y=%d ”,*px, *py); }
- 以下程序的输出结果是:main() { int a=12,b=12; printf(“%d %d ”,--a,b++); } A: 10 11 B: 11 13 C: 11 10 D: 11 12
- 下列程序的输出结果是()。int main(){ int a=11; printf("%d\n",a++); return 0;} A: 12 B: 11 C: 10 D: 9
- 执行如下语句后,x的值和输出结果分别是 ________。 int x=11; printf("%d", x+2); A: 11 11 B: 12 12 C: 11 13 D: 12 13