Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!purdue!bu-cs!bloom-beacon!husc6!cca!g-rh From: g-rh@cca.CCA.COM (Richard Harter) Newsgroups: comp.lang.c Subject: Question about VMS C Message-ID: <32725@cca.CCA.COM> Date: 30 Aug 88 06:31:50 GMT Reply-To: g-rh@CCA.CCA.COM (Richard Harter) Organization: Xerox Corporation, Cambridge, Massachusetts Lines: 28 The following came up on VMS C. Either my understanding of C is wrong, or the compiler is broken. The code ran as follows: char p[256]; ... foo () { ... int i,j, *s[128]; ... for (i=0;i<128;i++) s[i] = (int *)malloc(128*sizeof(int)); for (i=0;i<128;i++) { p[i] = ' '; p[i+128] = ' '; for (j=0;j<128;j++) s[i][j] = 0; } ... } When this code was executed sundry things were zeroed outside of s and the vectors pointed to by the elements of s. When the double subscripting was changed to *(s[i]+j) = 0 the code executed correctly. The double subscripting executes correctly on a host of UNIX machines and on PRIMOS. -- In the fields of Hell where the grass grows high Are the graves of dreams allowed to die. Richard Harter, SMDS Inc.