怎么这个程序不能通过?
[root@localhost c]# cat switch_case main() { unsigned short x; char c; scanf(%d,$c,x,c); switch (c) { case 'D': printf(%dD\n,x); break; case 'O': printf(%oO\n,x); break; case 'X': printf($xX\n,x); break; default : printf(input error\n !);
[root@localhost c]# cat switch_case
main()
{
unsigned short x;
char c;
scanf("%d,$c",&x,&c);
switch (c)
{
case 'D': printf("%dD\n",x);
break;
case 'O': printf("%oO\n",x);
break;
case 'X': printf("$xX\n",x);
break;
default : printf("input error\n !");
}
}
[root@localhost c]# gcc --version
gcc (G
CC) 3.2 20020903 (Red Hat
Linux 8.0 3.2-7)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warr
anty; not even for MERCH
ANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost c]# gcc switch_case
/usr/bin/ld:switch_case: file format not recognized; treating as linker script
/usr/bin/ld:switch_case:1: parse error
collect2: ld returned 1 exit status
[root@localhost c]#
help me!!
thanks i!!!
我懂了。原来源程序名要有.c的。
原文转自:http://www.ltesting.net
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
|