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

admin2013-02-23  34

问题 下面程序段的运行结果是(    )。    #include<stdio.h>    void main()    {char str[]="ABC",*p=str;    pfintf("%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://jikaoti.com/ti/ebn0FFFM
0

最新回复(0)