Home > Back-end >  Have bosses know how to change this error
Have bosses know how to change this error

Time:11-08

#include
Typedef struct {
Char name [20].
Int score [3].
} student;
Const int number=10;
Student * student_input (student * pstudent) {
The scanf (" % s ", & amp; Pstudent - & gt; Name);
int i=0;
For (I=0; i<3; I++) {
The scanf (" % d ", & amp; Pstudent - & gt; Score [I]);
}
Return pstudent;
}
Void student_print (const student * pstudent) {
Double avg=student_averge (pstudent);
Printf (" % d ", pstudent - & gt; Name);
int i;
for(i=0; i<3; I++) {
Printf (" % d ", pstudent - & gt; Score);
}
Printf (" % 5 f ", avg);
}
Void student_average (const student * pstudent) {//average student educational function, need to pass in a address
Double sum=0.0;
int i;
for(i=0; i<3; I++) {
The sum +=pstudent - & gt; Score [I];
}
}
Int main () {
Printf (" please enter the student's name and the subject result \ n ");
Student student [number].//create a capacity of 20 structure array
Student * pstudent;//create a pointer to the structure type, now internal also uninitialized pointer
Pstudent=& amp; Student [0].//will be used to store the first student data structure of the array structure first address assigned to a pointer just defined? Try to delete the line
int i;
for(i=0; i<10; I++) {//user input data packet into the structure of array
Pstudent=student_input (& amp; Student [I]);//main function defined in the pstudent pointer stored address information is child function after operation in the structure of the array address
Pstudent++;
}
Printf (" No \ tname \ tscore1 \ tscore2 \ tscore3 \ t ");
Pstudent=& amp; Student [0].
for(i=0; iStudent_printf (pstudent);
Pstudent++;
}
return 0;
}
C: \ Users \ yhxc \ Desktop \ \ C language program statistics class students grades. C In the function 'main' :
34 11 C: \ Users \ yhxc \ Desktop \ \ C language program statistics class students grades. C [Error] 'pstudent undeclared (first use in this function)
34 11 C: \ Users \ yhxc \ Desktop \ \ C language program statistics class students grades. [Note] C each undeclared identifier is reported only once for each function it appears in the
  • Related