LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 617|回复: 2

有一个问题想请教各位大侠们?

[复制链接]
发表于 2006-11-18 14:55:40 | 显示全部楼层 |阅读模式
以下为未解的问题:
      1 #include <stdio.h>
      2
      3 void            
      4 ls()            
      5 {               
      6       printf("I love you too!");
      7 }               
      8 struct a  
      9 {
     10       void  (*a)();
     11       char  *s;
     12 };
     13 struct a a[3];
     14 int
     15 main()
     16 {     
     17       a[0]={ls,"I love you!"};
     18       a[0].a();
     19       printf("%s\n",a[0].s);
     20 }     
[root@localhost root]# gcc -g test1.c -o test1
test1.c: In function `main':
test1.c:17: parse error before '{' token
test1.c: At top level:
test1.c:18: parse error before '.' token
test1.c:19: parse error before string constant
test1.c:19: warning: conflicting types for built-in function `printf'
test1.c:19: warning: data definition has no type or storage class
发表于 2006-11-18 16:04:46 | 显示全部楼层
。。。纯属瞎搞
你到底想要a是什么类型呢
回复 支持 反对

使用道具 举报

发表于 2006-11-18 16:09:44 | 显示全部楼层
我的gcc 4.0没有报错
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表