[comp.sys.ibm.pc] Any fix or workaround for this Turbo C realloc bug?

ado@elsie.UUCP (Arthur David Olson) (10/12/87)

When I compile and run this program using Turbo C:

	#include "stdio.h"

	main()
	{
		char *		line;
		extern char *	malloc();
		extern char *	realloc();

		line = malloc(1);
		line[0] = '1';
		printf("%c (%d)\n", line[0], line[0]);
		line = realloc(line, 2);
		printf("%c (%d)\n", line[0], line[0]);
		return 1;
	}

I discover that line[0] has changed from under my feet as a result of the
realloc call.  If you have a fix or workaround, I'd appreciate hearing from
you.
-- 
ado@vax2.nlm.nih.gov	ADO, VAX, and NIH are trademarks of Ampex and DEC.