Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!china.uu.net!snow From: snow@china.uu.net (John Snow) Newsgroups: comp.lang.c Subject: How do you do this??? Message-ID: <167@salt.UUCP> Date: 8 Dec 89 20:19:38 GMT Reply-To: snow@salt.UUCP (John Snow) Organization: MDCCIS, Englewood, CO Lines: 40 I am writing a program where I need to dynamically allocate memory for an array of strings (ie list[x][10]), but I can't seem to please the compiler. I want to be able to use it in the form: for (x = 0; x < n; x++) strcpy (list[x], source[x]); As a first shot I tried: typedef ARRAY[][10]; ... { ARRAY list; /* tried both 'list' and '*list' */ list = calloc (5, 10); ... } The compiler was not at all impressed with that. After trying several things I finally found one that at least compiles and runs, even though the compiler does gripe about it. That is: { char (*list)[10]; list = calloc (5, 10); ... } Even thought this *seems* to work, I don't have a warm-fuzzy because of the compiler warning. Could somebody tell me how to do this in a clean way? Any suggestions would be greatly appreciated. Thanks, John -- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: :: John Snow - MDC | any opinions are purely accidental :: Denver, Colorado | and not the fault of the management :: Try mailing to: [snow@china.uu.net] or maybe [uunet!china!snow]