很感谢上次,大侠们帮我解决了一个问题,我希望能够再次得到大侠们的帮助; #include <stdio.h> void main () { int month=3,day=20; char msg [41]="taotao,i went out tor a while!"; printf ("++++++++++++++++++++++++++++++++++++++++\n"); printf ("+ note board +\n"); printf ("+ +\n"); printf ("+%s+\n",msg); printf ("+ +\n"); printf ("+ %2d\\%2d +\n",month,day); printf ("+++++++++++++++++++++++++++++++++++++++\n"); } 按ALT+F9后,显示二处错误 declaration syntax error undefinde symbol 'msg' 由于本人是新手的,不知道从哪开始,现在只会对着书, (人民邮电出版社,出版-沟通从C语言开始)里的练习,不知道C语言的语法,大侠们有什么好的建议,能让我了解下C语言的语法吗?
[此贴子已经被作者于2005-7-21 12:51:08编辑过]
----------------解决方案--------------------------------------------------------
char msg [41]="taotao,i went out tor a while!";
改成
char msg [41]={'t','a','o','t','a','o',',','i',' ','w','e','n','t',' ','o','u','t',' ','t','o','r',' ','a',' ','w','h','i','l','e','!'};
----------------解决方案--------------------------------------------------------
很感谢大侠对我的帮助,
我按你所说的把char msg [41]="taotao,i went out tor a while!";
改成
char msg [41]={'t','a','o','t','a','o',',','i',' ','w','e','n','t',' ','o','u','t',' ','t','o','r',' ','a',' ','w','h','i','l','e','!'};
后再用ALT+F9编译,可还会出现
declaration syntax error
undefinde symbol 'msg'
希望大侠们再帮我下,
----------------解决方案--------------------------------------------------------
你用什么编译的?
----------------解决方案--------------------------------------------------------
我在WINXP,TC2.0环境下编译通过
----------------解决方案--------------------------------------------------------
我在winxp环境下,用turboc3.0完整版
[此贴子已经被作者于2005-7-21 12:52:15编辑过]
----------------解决方案--------------------------------------------------------
请使用TC2.0
----------------解决方案--------------------------------------------------------
vc 6.0也可以
----------------解决方案--------------------------------------------------------
只有静态数组才可以赋初值,应该在char msg[41]……前加上static.
----------------解决方案--------------------------------------------------------
那我买的那本书太垃圾了,
我就是对着书上的程序照抄过去编写的,
----------------解决方案--------------------------------------------------------