you did not allocate memory for the int* Tests variable.
the thing is I have a
testScores = new int[numTests];
but you don't use that nowhere
Now, the thing is like this
Reading your program what you actually try to do is iterate through each student and give to him numTests marks. That means the purpose of int* Tests is to point at the start of an array of numTests elements. That means at each iteration of the outer for you need to allocate memory numTests ints in you int* Tests pointer.
Your program should look like this in oder to just work:
struct studInfo
{
char Name[31];
short Idnum;
int* Tests;
float avg;
char grade;
};
void main()
{
short numTests, numStudents;
studInfo* student;
int* testScores;
cout << "How many Students? : ";
cin >> numStudents;
cout << "\nHow many test scores? : ";
cin >> numTests;
student = new studInfo[numStudents];
for ( int i = 0; i < numStudents; i++ )
{
cout << "\nEnter ID for student " << (i + 1) << ": ";
cin >> student[i].Idnum;
testScores = new int[numTests];
for ( int j = 0; j < numTests; j++ )
{
cout << "\nEnter test score " << (j + 1) << " for student " << i + 1 << ": ";
//put the result at tre corresponding position in the array
cin >> *(testScores + j); //or …