我编了如下代码:
#include"stdio.h"
struct stu
{
int i;
int j;
};
int add(struct stu &g)
{
int k;
k=stu.i+stu.j;
return k;
}
main()
{
int k;
struct stu student;
student.i=1;
student.j=2;
k=add(student);
printf("%d",k);
}
编译时出现如下错误:
:\123\main.c(7) : error C2143: syntax error : missing ')' before '&'
e:\123\main.c(7) : error C2143: syntax error : missing '{' before '&'
e:\123\main.c(7) : error C2059: syntax error : '&'
e:\123\main.c(7) : error C2059: syntax error : ')'
e:\123\main.c(19) : warning C4013: 'add' undefined; assuming extern returning int
Error executing cl.exe.
main.obj - 4 error(s), 1 warning(s)
哪位高手帮忙看看如何修改谢了