Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!husc6!cs.utexas.edu!rutgers!orstcs!ladder!flatmas From: flatmas@ladder.cs.orst.edu (Scott Timothy Flatman) Newsgroups: comp.lang.c Subject: arrays of pointers - NOVICE QUESTION!( Be forwarned ! ) Keywords: pointers, arrays Message-ID: <10971@orstcs.CS.ORST.EDU> Date: 3 Jun 89 22:28:24 GMT Sender: usenet@orstcs.CS.ORST.EDU Reply-To: flatmas@ladder.CS.ORST.EDU (Scott Flatman) Followup-To: The above address. Organization: Oregon State Univ. -- Computer Science Lines: 28 Recently someone posted a remark that these two declarations are the same: char *array[some size - you choose]; and char **array; My understanding is that the first declaration is for an array of pointers to char. The second one is confusing me. How is it interpreted? I tried looking this up in Kernighan and Ritchie. I did not get a satisfactory explaination. So I tried to make up a simple example along these lines: ex#1: static char *array[2] = {"Hello","World"}; printf("%s %s",*array,*(array+1)); This just prints out "Hello World". I would like to do the same thing using a declaration such as: char **array; and then dynamically allocating the storage for the two strings "Hello","World". Could anybody send me a simple example. I am trying to figure out how these declarations are similar.Also any other bits of code along these lines that illustrate the idea of "arrays of pointers" would be helpful to me. Thanks for your support! ---------------------------------------------------- Scott Flatman INTERNET: flatmas@ladder.cs.orst.edu UUCP: hplabs!hp-pcd!orstcs!ladder.cs.orst.edu!flatmas ---------------------------------