Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!rex!samsung!munnari.oz.au!mimir!hugin!augean!sirius.ua.oz.au!nt!levels!marwk From: MARWK@levels.sait.edu.au Newsgroups: comp.lang.c Subject: A pointer to a 3-D array, or an array of ptrs to 2-D arrays? Message-ID: <2765@levels.sait.edu.au> Date: 14 Nov 89 18:23:43 GMT Organization: Sth Australian Inst of Technology Lines: 16 Why does (1) work but (2) does not? (1) p = (int (*) [13][2][64]) malloc (sizeof(int) * 13 * 2 * 64) *p[i][j][k] = 6 (2) p = (int (*) [2][64]) malloc (sizeof(int) * 13 * 2 * 64) p[i][j][k] = 6 These are both supposed to be ways of dynamically creating a 3-dimensional array for accessing as such, but (1) causes a segmentation error when run on the ENCORE. Thanks in advance. Ray