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

admin2020-05-19  12

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

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

答案B

解析 函数fun的主要功能是计算字符串中实际字符的个数,因此"goodbey!"含有字符为8,返回值为8。
转载请注明原文地址:https://kaotiyun.com/show/myCp777K
0

相关试题推荐
最新回复(0)