R
rockdale
char* temp = (char*) malloc(10*sizeof(char));
temp="0123456789";
free(temp);
the free(temp) line got the error:
File: f:\\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c
Line: 1317
Expression: _CrtIsValidHeapPointer(pUserData)
if I change the assignment of temp as following
temp[0] = 'a';
temp[1] = 'a';
temp[2] = 'a';
temp[3] = 'a';
temp[4] = 'a';
temp[5] = 'a';
temp[6] = '\0';
anybody can explain this to me.
I am using Visual Studio 2008 on windows xp.
Is that a Visual Studio problem or it is my code?
thanks in advance.
temp="0123456789";
free(temp);
the free(temp) line got the error:
File: f:\\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c
Line: 1317
Expression: _CrtIsValidHeapPointer(pUserData)
if I change the assignment of temp as following
temp[0] = 'a';
temp[1] = 'a';
temp[2] = 'a';
temp[3] = 'a';
temp[4] = 'a';
temp[5] = 'a';
temp[6] = '\0';
anybody can explain this to me.
I am using Visual Studio 2008 on windows xp.
Is that a Visual Studio problem or it is my code?
thanks in advance.