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

admin2016-12-28  17

问题 有以下程序
    #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/rwDp777K
0

最新回复(0)