L
Liu Ju
Dear people,
I wrote a program in Visual C6 in which I used the functions
"malloc" and "free". The errors sometimes appears due to some mystery
causes.
A friend of mine suggested that I use new and delete functions instead
since malloc and free are not always good.
My aim is to set aside a free range of memory and then initialize
these values. My orginal source codes using malloc and free:
-----------------
int *accum;
float *tabSin;
float *tabCos;
accum = (int *) malloc( sizeof( int ) * numangle * numrho );
tabSin = (float *) malloc( sizeof( float ) * numangle );
tabCos = (float *) malloc( sizeof( float ) * numangle );
memset( accum, 0, sizeof( int ) * numangle * numrho );
blah blah blah
I wrote a program in Visual C6 in which I used the functions
"malloc" and "free". The errors sometimes appears due to some mystery
causes.
A friend of mine suggested that I use new and delete functions instead
since malloc and free are not always good.
My aim is to set aside a free range of memory and then initialize
these values. My orginal source codes using malloc and free:
-----------------
int *accum;
float *tabSin;
float *tabCos;
accum = (int *) malloc( sizeof( int ) * numangle * numrho );
tabSin = (float *) malloc( sizeof( float ) * numangle );
tabCos = (float *) malloc( sizeof( float ) * numangle );
memset( accum, 0, sizeof( int ) * numangle * numrho );
blah blah blah