Dynamic array inside a structure

Another 11th hour challenge from my homework. I know exactly what I need to do, just not how to do it.

The assignment involves making a structure of student data, and inside the structure we have to have a pointer to an array of test scores. Then we have to have an array of those structures.

So I've created the structure and a loop to gather the rest of the structure data, now I have to make a loop inside that gathers the test scores.

I'm very iffy on pointers in general, so trying to dynamically assign an array inside of a loop in a structure and then point to it is... well its hard.

This is the code I am trying to use:

 		double *test;
		test = new double student.tests[testnum];

student.tests[testnum] is giving a compiler error. The structure(called student) has a double member called tests that the pointer is supposed to be pointing at. Or is the pointer supposed to be inside the structure?

As you can no doube guess, I am very confused. I hope I've explained this adequietly, thank you in advance!
Last edited on
Topic archived. No new replies allowed.