studentType newStudent() // studentType doesn't exist here
{
struct studentType // it only exists within the function
{
string studentID;
string firstName;
string lastName;
string subjectName;
string courseGrade;
int arrayMarks[4];
double avgMarks;
} newStudent;
...
Move it outside the function:
struct studentType
{
string studentID;
string firstName;
string lastName;
string subjectName;
string courseGrade;
int arrayMarks[4];
double avgMarks;
};
studentType newStudent()
{
studentType newStudent
...
return newStudent;
}