下列程序段的运行结果是( )。 #include<stdio.h> void main() { char str[]="ABC",*p=str; printf("%d\n",*(p+3) ); }

admin2010-09-05  29

问题 下列程序段的运行结果是(    )。
   #include<stdio.h>
   void main()
   {  char str[]="ABC",*p=str;
   printf("%d\n",*(p+3) );
   }

选项 A、67
B、0
C、字符’C’的地址
D、字符’C’

答案B

解析 先定义了一个指向字符型数组str的指针p,指针p指向数组str的首地址,p+3将指针指向str[3],又因为字符型数组在存放字符串时会自动在末尾加上’\0’,所以*(p+3)=0。
转载请注明原文地址:https://kaotiyun.com/show/iaWp777K
0

随机试题
最新回复(0)