Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: LSC malloc returning garbage Message-ID: <26024@ucbvax.BERKELEY.EDU> Date: 10 Sep 88 01:11:31 GMT References: <1451@murdu.OZ> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 16 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