课堂作业修改

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    char str[]={"hello world"};
    void funstr(char str[]);
    str[0]='H';
    str[6]='W';
    funstr(str);
    system("pause");
    return 0; 
}
void funstr(char a[])
{
    int i;
    printf("%s\n",a);
    for(i=0;i<strlen(a);i++)
    {
        printf("%c",a[i]);
    }
}
Hello World
Hello World请按任意键继续. . .

--------------------------------
Process exited after 1.72 seconds with return value 0
请按任意键继续. . .

总结:题头忘记打string这个头文件,导致strlen这个函数没有定义,编译时有提示,后来发现了。

posted on 2017-03-31 19:16  何丽婷  阅读(124)  评论(0编辑  收藏  举报

导航