首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

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

2013-04-20 
【求助】关于结构体的函数传参谢谢int main(){int print (struct student)struct student{int numchar nam

【求助】关于结构体的函数传参 谢谢
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……

热点排行