unable to free 1 of the struc member
When i try code below i still able to access y.field1 value even after free it. Is it anything wrong with my code ?
Code:
typedef struct
{
char* field1;
char* field2;
}lookup;
void main(void)
{
lookup y;
y.field1 = (char*)malloc(4);
strcpy(y.field1,"123");
clrscr();
printf("\n%s",y.field1); //print out 123
printf("\n%d",y.field1);
free (y.field1); //After try free field1 i still able to print out 123 in subsequenceline
printf("\n%s",y.field1); //still print out 123
}