Here is my program

Code: C++
class MEM{
  float** GEN(void)
  float** X=(float**)malloc(sizeof(float)*3);
for (int Row=0; Row<3; Row++)
for (int Col=0; Col<3; Col++)
  X[Row][Col]=(float) rand();
return X;


int main()
MEM test;
 for (int NT=0; NT<100; NT++)
return 0;

I found that the memory always can not be free. If the NT or 3 is very large, it will break the system. Could you help me how to free the memory in subprogram?

Thank you very much! Email:

Last edited by SaswatPadhi; 13Aug2009 at 05:44..