Shrinking with realloc

signup at valhalla.cs.ucla.edu signup at valhalla.cs.ucla.edu
Thu Aug 10 11:58:16 AEST 1989


If realloc is used to shrink a chunk of allocated storage, is it guaranteed
by the standard that the storage won't be moved?  I couldn't find any positive
or negative statement about the matter.

I.e., after
	char *p, *q;
	q = p = (char *) malloc(10);
	(void) realloc(p,5);
is it valid to dereference q?



More information about the Comp.std.c mailing list