#include
#include
struct data
{
int day,month,year;
} ;
struct stu
{
char name[20];
long num;
struct data birthday;
} ;
int main()
{
struct stu *student;
student=malloc(sizeof(struct stu));
printf("Input name,number,year,month,day:/n");
scanf("%s",student->name);
scanf("%ld",&student->num);
scanf("%d%d%d",&student->birthday.year,&student->birthday.month,
&student->birthday.day);
printf("/nOutputname,number,year,month,day/n");
printf("%20s%10ld%10d//%d//%d/n",student->name,student->num,
student->birthday.year,student->birthday.month,
student->birthday.day);
return 0;
}
程序怎么出错了,求大神解答!!
错误报告是这样的。
E:\c++稿子\sdas.cpp(16) : error C2440: '=' : cannot convert from 'void ' to 'struct stu *' Conversion from 'void' to pointer to non-'void' requires an explicit cast 执行 cl.exe 时出错.