I have a struc like this:
struct process {int PID;int myMemory[];};
however, when I try to use it
process p;
int memory[2];
p.myMemory = memory;
I get an criptic error from eclipse saying int[0] is not compatible with int[2];
what am i doing wrong?
Thanks!
Don’t use static arrays,
malloc, or evennewif you’re using C++. Usestd::vectorwhich will ensure correct memory management.I might also suggest creating a constructor so that
piddoes not initially have an undefined value: