Dynamic Arrays

-deleted-
Last edited on
-deleted-
Last edited on
Just some hints are okay.
Please don't post direct solutions.
I want to solve it by my own eventually.

Thanks all!
Step through your code using a debugger, look at the variables and how they change line by line at execution...see what works, and what isn't working...and then try and find what is different.

If you don't know about setting breakpoints in your compiler and watching variables etc...might look that up.

should show you everything you need to know about what is happening in your code.

good luck =D
I am assuming you have also declared two more structs elsehwere

Student* students;
Course* courses;


You are doing this wrong, I am guessing. try changing it

1
2
3
4
5
6
7
void queryE(Database d, string courseCode)
{
    for (int i = 0; i < d.numberOfEnrollRecords; i++)
    {
        EnrollRecords temp[d.numberOfEnrollRecords];//here every time it is     being newly defined
       
     


Last edited on
Yes I have declared

Student* students;
Course* courses;

These are used in tasks before this one...
I can handle those tasks well by myself...

Now I just cannot change the order of displaying
I am thinking... even if I change the order of the d.enrollRecords[i].exam (which is a double), its corresponding d.enrollRecords[i].uid is still the original one...


Is there any notes teaching people how to deal with this? Swaping things inside a struct and dynamic array?
consider pass by reference
Topic archived. No new replies allowed.