CodePudding user response:
Should be no problem!What's your error
CodePudding user response:
Can send the source codeLet me try
CodePudding user response:
#include#include
Struct std_infor
{
Char * std_name;
};
Struct std_infor student [51].
Int main ()
{
Void infor_in ();
Infor_in ();
}
Void infor_in ()
{
Printf (" please enter the student's name \ n ");
The scanf (" % s ", & amp; Student [0]. Std_name);
Printf (" % s ", student [0]. Std_name);
}
//there will be abnormal to the output
CodePudding user response:
the original poster is a character of the definition of, is not a string, modify the following:struct std_infor
{
Char std_name [20].
};
Struct std_infor student [51].
Int main ()
{
Void infor_in ();
Infor_in ();
for(int i=0; i<51. I++)
Printf (" % s \ n ", student [I] std_name);
return 0;
}
Void infor_in ()
{
Printf (" please enter the student's name \ n ");
for(int i=0; i<51. I++)
The scanf (" % s ", & amp; Student [I] std_name);
}
CodePudding user response:
the original wellCodePudding user response:
If using a pointer, allocating memory, and give it to use strcpy copy content