读书人

关于结构体的函数传参 多谢

发布时间: 2013-04-20 19:43:01 作者: rapoo

【求助】关于结构体的函数传参 谢谢
int main()
{
int print (struct student);
struct student
{
int num;
char name[10];
int score;
};
struct student stu = {104, "dongdong", 90};

print (stu);
}


#include <stdio.h>
int print (struct student stu)
{
printf ("num = %d\nname = %s\nscore = %d\n", stu.num, stu.name, stu.score);
}

编译器提示print函数的形参struct "不允许使用不完整的类型" . 为什么 该怎么处理?
[解决办法]
写在里面的话,只有main看得到这个类型,对print函数来说是不可见的。

引用:
引用:那你要#include的方式。

引用:引用:决不可能!

引用:引用:C/C++ code?12345678910111213141516171819202122struct stude……

读书人网 >C语言

热点推荐