大神,咨询一下返回结构体类型指针的问题!!!
#include<stdio.h>#include<stdlib.h>
#define N 3
struct student
{
int num;
char name[20];
int socer[3];
}stu[N];
int main(void)
{
struct student *input();
void output(struct student *p2);
struct student *p;
struct student *p2;
printf("num name socer\n");
p=intput();
p2=p;
printf("num name socer\n");
output(p2);
return 0;
}
struct student *input()//字符数组的输入函数?
{
struct student *p;
p=stu;
for(;p<stu+N;p++)
scanf("%d%s%d%d%d",&p->num,&p->name,&p->socer[0],&p->socer[1],&p->socer[2]);
p=stu;
return(p);
}
void output(struct student *p2)
{
for(;p2<stu+N;p2++)
printf("%5d %-10s %2d %2d %2d\n",p2->num,p2->name,p2->socer[0],p2->socer[1],p2->socer[2]);
putchar('\n');
}
、、、、、、、、、、、、、、连接不到struct student *input()这个自定义函数