[Solved] Unable to output anything. [closed]


Review your syntax for calling functions:

S2 = *studentData(S1);

I believe functions are called without the ‘*’:

S2 = studentData(S1);

There may be more like this in your program.

Edit1: Passing by reference, returning pointer to passed reference

On further inspection of your program, the function studentData receives a Student variable passed by reference. This means that the original variable passed to this function can be modified directly. At the end of the function, you return a pointer to this variable. Kind of redundant.

Similarly with changeData().

Also, per requirement #2, the function StudentData needs to return a reference not a pointer. The declaration would look like:

Student& StudentData(Student& any_student);

Note the spelling of the function per requirement.

2

solved Unable to output anything. [closed]