Do yourself a favour and rewrite that.
Write a function that accepts a single parameter (a pointer to a student) and gets the relevant information from the user:
student* GetStudentDetail (student* s)
{
...
return s;
}
Use the debugger to test that that works properly when you pass it a valid student pointer:
int main()
{
Student s;
GetStudentDetail(&s);
}
Write a second function PrintStudentDetail which takes the same parameter and displays a human readable student:
student* PrintStudentDetail (student* s)
{
...
return s;
}
Then again use the debugger to prove that works:
int main()
{
Student s;
PrintStudentDetail(GetStudentDetail(&s));
}
Then modify the
main
function to support multiple Students: prove that works.
Then write a function called SerializeStudents which takes an array of Student objects and outputs them to a file:
void SerializeStudents(char* path, student students[])
{
...
return s;
}
And then look at the file content using a hex editor, since the data will not be human readable.