> -----Original Message----- > From: Robert Brinson > Sent: Thursday, August 08, 2002 3:41 PM > > Hi, all. I'm reading through _Palm OS Programming: The > Developers Guide, > 2nd Edition_. I will admit that I am still wet behind the ears with > C/C++, but I cannot find the answer to this question in Bjarne > Stroustrups _The C++ Programming Language, Special Edition_. > On page 258 > of the Palm OS book, a piece of sample code is given that I do not > understand. If anybody could offer some insight, I would be grateful. > > <quote> > Using the first approach, we need to create an array with each element > pointing to a string. We'll store that array as a global (so > that we can > deallocate it later): > > static Char **gStringsPtrArray = NULL; > </quote> > > What type of variable was just created and initialized when > ** is used? >
A '**' basically denotes a pointer to a pointer, and in this case it would be a pointer to an array of char pointers (array of strings). The char pointer (char*) is used in C to point to an array of characters, which represents a string. An array is actually a pointer to the 0th element of the array, so dereferencing the array name will give you the 0th element. Hence, declaring 'char *array;' is the same as declaring it 'char array [];' and 'char** array;' is the same as 'char* array[];'. I hope that helps. Vinu -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
