Hi All,
I have a very basic query. I know that after deallocating memory for a
pointer , when we try to access it , we will get access violation error. From
top of my memory , even I tried it and worked on it. But now I dont know why
but my code is working in wrong manner now. Can any one of you please suggest
it please. I am using VisualStudio 2005 compiler. on windows xp.
#include<stdio.h>
#include<malloc.h>
void main()
{
int *i;
i=(int *)malloc(1*sizeof(int));
*i=30;
free(i); // freed the mem
*i=50; // Tried to acces it again .. Ideally , it should fail . But it is
not failing .. can any //one explain the reason.
}
Thx,
--Gopi
Connect with friends all over the world. Get Yahoo! India Messenger at
http://in.messenger.yahoo.com/?wm=n/
[Non-text portions of this message have been removed]