Can you help me resolve this question, please? I do appreciate it. float *h is an instance variable, x = 2, when I call this function, in gdb it shows that
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x000000000100a370
0x0000000100001e2d in ImageGS::hist (this=0x100100a41, x=2) at ImageGS.cpp:180
180 h[i] = float(array[i])/num;
before the (array[loc])++;[this is highlighted in codes with "//////"], everything is right, r =375, c=500. But after this array evaluation loop, h cannot be got using "print h[0]", which is "Cannot access memory at address 0x100a370"