有以下程序 #include int fun(char s[]){ char*P=s: while(*P!=0) p++; return(p-s);} main(){ printf("%d\n",f

admin2015-08-14  19

问题 有以下程序
    #include
    int fun(char s[]){
    char*P=s:
    while(*P!=0)  p++;
    return(p-s);}
    main(){
    printf("%d\n",fun("0ABCDEF"));}  
    程序运行后的输出结果是

选项 A、6
B、7
C、1
D、0

答案B

解析 函数fun的主要功能是计算字符串中实际字符的个数,因此主函数中调用fun得到结果为7。
转载请注明原文地址:https://kaotiyun.com/show/yGDp777K
0

最新回复(0)