Int main ()
{
Int no;
int i;
Printf (" please enter the student student number: ");
The scanf (" % d ", & amp; No);
For (I=0; I & lt; 3; I++)
{
If (no==stu [I] no)
{
Printf (" student id \ \ t name on \ t t \ \ t t years gender \ t result \ n ");
Printf (" % d % d \ % s \ \ t t t t % d \ % d \ \ t t % d % d ", stu [I] no, stu [I]. Name, stu [I]. Birthday. The month, stu [I]. Birthday. The day, stu [I] birthday. Year, stu [I] sex, stu [I] score).
break;
}
}
getchar();
getchar();
return 0;
}
Struct date
{
Int the month;
Int day;
Int year;
};
Struct student
{
Int no;
Char name [20].
Struct date birthday;
Int sex;
Int score;
};
Struct student stu [3]={
{3, "zhangsan", 12,5,2015,1,23},
{1, "zhangyi", 1,3,2013,2,27},
{2, "zhanger", 10,8,2016,1,25}
};
The content of the image shows the error
I am playing down the code according to the book, i.e., why always an error, is really can't find the problem
CodePudding user response:
TheStruct date
{
Int the month;
Int day;
Int year;
};
Struct student
{
Int no;
Char name [20].
Struct date birthday;
Int sex;
Int score;
};
Struct student stu [3]={
{3, "zhangsan", 12,5,2015,1,23},
{1, "zhangyi", 1,3,2013,2,27},
{2, "zhanger", 10,8,2016,1,25}
};
This part of the move to the top of the main function, otherwise, the main function can't use these structures and stu variables, namely statement first, then use, must ensure that the statement before the main function,
CodePudding user response:
There is no statement on the main function, and calls a function in the main problemsCodePudding user response: