I just had an issue like that!So what the assignment is, is to implement malloc (memory allocation).
In c# I replaced the variable with a function that acted like a variable. Then it could print a message everytime it was changed and tell me who changed it. Does c++ have similar?
But it requires a data structure to keep track of data locations.
I was using an array that would change length, by getting reassigned basically.
But apparently assigning the arrays that way has some unusual behaviors.
I changed all the declarations to utilizing malloc, which feels wrong. Now it works great.
It's apparently fine if the data structure uses malloc, but eh I don't like it.