Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!hsdndev!wuarchive!cs.utexas.edu!uunet!shelby!neon!gjohn From: gjohn@Neon.Stanford.EDU (George H. John) Newsgroups: comp.sys.mac.programmer Subject: Novice question about malloc() in Think C Message-ID: <1991Feb25.103404.3662@Neon.Stanford.EDU> Date: 25 Feb 91 10:34:04 GMT Sender: gjohn@neon.stanford.edu (George John) Distribution: usa Organization: Computer Science Department, Stanford University Lines: 22 I'm having a problem porting source code from a unix machine to my mac. It seems that once I work out bugs caused by the difference in default integer sizes (2bytes mac, 4bytes unix) I'm having weird problems with malloc. For example, the following code doesn't work quite (er, at all) right: int *y; y = (int *) malloc (sizeof(int)); *y = 5; If I replace the malloc with NewPtr, things work fine, but it doesn't seem right that the brilliant people at symantec would develop wonderful user interfaces and debugging tools and forget to write a working malloc(). What's up? I've repeated this problem on several machines. Thanks for any help, George John