[comp.sys.mac.programmer] LSC malloc returning garbage

oster@dewey.soe.berkeley.edu (David Phillip Oster) (09/10/88)

In article <1451@murdu.OZ> strasser@munnari.UUCP (Mike Strasser) writes:
>	Sp = (Species *) malloc( sizeof( Species ) );

Have you checked that you've included "unix.h" or "memory.h" or whatever
it is so that the compiler knows that malloc() returns a pointer and not an
int?

>	printf( "Sp is %08X\n", (unsigned long) Sp );

Note: this is certainly wrong in LightSpeed C of any version. You mean:
	printf( "Sp is %08lX\n", (unsigned long) Sp );

the %lx means long in hex.

--- David Phillip Oster            --When you asked me to live in sin with you
Arpa: oster@dewey.soe.berkeley.edu --I didn't know you meant sloth.
Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu