mike@odgate.odesta.com (Mike J. Kelly) (04/26/91)
In article <frost.672455128@watop> frost@watop.nosc.mil (Richard Frost) writes: >I am trying to dynamically allocate space for a 2d array USING Think C 4.0 >(on a Macintosh IIci). Here's what I've tried: > >------------------------ >#define max_el 128 >#define max_az 2048 > >int el, az; >unsigned int **image; > > **image = (unsigned int **) malloc(max_el * sizeof(unsigned int *)); ^^ this deferences an undefined pointer. **image is of type unsigned int, but you're assigning a pointer to pointer value to it. What I think you want is: image = (unsigned int **) malloc(max_el * sizeof(unsigned int *));