Xref: utzoo comp.sys.mac.programmer:5310 comp.sys.mac:29395 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!hao.ucar.edu!bill From: bill@hao.ucar.edu (Bill Roberts) Newsgroups: comp.sys.mac.programmer,comp.sys.mac Subject: LSC3.0 brain damage Keywords: stdio, pointers Message-ID: <1704@ncar.ucar.edu> Date: 1 Apr 89 22:44:00 GMT Sender: news@ncar.ucar.edu Reply-To: bill@hao.ucar.edu (Bill Roberts) Distribution: usa Organization: High Altitude Observatory/NCAR, Boulder CO Lines: 31 Below is a simple code segment that I was trying to use on a Mac+ using LSC 3.0. The problem is that the printed value of ptr never increments. It always stays the same! I move this code over to a Sun4 and it works as one would expect! What gives? Anyone else run into this problem? ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #include #include #include main() { char *ptr; int max= 400; if ((ptr= (char *)malloc(500)) == NULL){ fprintf (stderr,"ERROR: malloc() \n"); exit(); } while (max--) fprintf (stderr,"ptr= %d\n", ptr++); } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; --Bill UUCP: {nbires, noao}!ncar!hao!bill CSNET: bill@ncar.csnet ARPA: bill%ncar@CSNET-RELAY.ARPA INTERNET: bill@hao.ucar.edu "... the Eagle Wing palace of the Queen Chinee'"