On Mon, Jul 16, 2007 at 02:39:39PM -0000, Wolfram Gloger wrote: > > int *p; > > p = malloc (4); > > *p = 0; > > p = realloc (p, 4); > > *p = 1; > > By that reasoning, consider: > > int *p; > p = malloc (4); > *p = 0; > free(p); > p = malloc (4); > *p = 1;
Except that in the first sequence, the value of *p is retained across the reallocation, so "*p = 0" is not dead. The two examples aren't really the same at all. r~