标签:[] -- after stdio.h value val 补充 导致 for
#include<stdio.h> #include<stdlib.h> void funstr(char *s) { int a=0; while(*(s+a)!=‘\0‘) { printf("%c",*(s+a++)); } printf("\n"); printf("%s",s); } int main() { char str[]="hello world"; str[0] = ‘H‘; str[6] = ‘W‘; funstr(str); system("pause"); return 0; }
这是正确代码
#include<stdio.h> #include<stdlib.h> void funster(char s[]) { int a=0; while((s+a)!=‘\0‘) { printf("%c",s+a++); } printf("\n"); printf("%s",s); } int main() { char str[]="hello world"; str[0] = ‘H‘; str[6] = ‘W‘; funstr(str); system("pause"); return 0; }
这是我上课时的代码
刚开始我打算用for ,经过室友的帮助 建议我运用while 之后由于忘记打地址疯狂输出,导致只能重启
知道经过老师的点播 发现函数名打错
Hello World Hello World -------------------------------- Process exited after 0.6025 seconds with return value 0 请按任意键继续. . .
标签:[] -- after stdio.h value val 补充 导致 for
原文地址:http://www.cnblogs.com/tkh666/p/6649831.html