Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!tut.cis.ohio-state.edu!dsac.dla.mil!dsacg3.dsac.dla.mil!dsacg2.dsac.dla.mil!nol2321 From: nol2321@dsacg2.dsac.dla.mil (Jim Dunn) Newsgroups: comp.lang.c Subject: ** help... Summary: please declare and define my **array... Message-ID: <2409@dsacg2.dsac.dla.mil> Date: 20 Aug 90 21:37:39 GMT Followup-To: jdunn@dsac.dla.mil Organization: Defense Logistics Agency Systems Automation Center, Columbus Lines: 41 Well, no one took me up on my offer of checking out the Curses Source I've been working on, so I'll ask a "more direct and specific" question... Why can't I do the following?!? (C'mon you gurus...) ---Cut Here--- #include typedef struct _window { int x; int y; int **array; int beg_x; int beg_y; int max_x; int max_y; } WINDOW; main() { int x, xL = 10; WINDOW *w1; w1 = (WINDOW *) malloc(sizeof(WINDOW)); /* the problem is next */ w1->array = malloc( xL * sizeof(int) ); /* isn't the above line legal, or how can I allocate mem for the storage */ for(x=0;x < xL; x++) w1->array[x] = (int *) malloc( 10 * sizeof(int *) ); } This is setup for, let's say, a 10 x 10 matrix of ints, OK? It'll compile ok, but it'll lock up the machine... (at least on the PC). Jim jdunn@dsac.dla.mil