Possible Duplicate:
How do I use arrays in C++?
I have the following C code:
int main () {
char *pathvc[MAX_PATHS];
parsePath(pathvc);
struct command_t command;
command.name = lookup(command.argv, pathvc); //command.argv is: char *argv[MAX_ARGS];
}
char* lookupPath(char **argv, char **dir) {
//Some implementation
}
This is the debug information that I am getting in the main function:
Name : pathvc Details:{0x804c208 "/usr/lib/lightdm/lightdm", 0x804c221 "/usr/local/sbin", 0x804c231 "/usr/local/bin", 0x804c240 "/usr/sbin", 0x804c24a "/usr/bin", 0x804c253 "/sbin", 0x804c259 "/bin", 0x804c25e "/usr/games", 0x0 } Default:0xbffff0a8 Decimal:3221221544 Hex:0xbffff0a8 Binary:10111111111111111111000010101000 Octal:027777770250
Name : pathvc[0] Details:0x804c208 "/usr/lib/lightdm/lightdm"
Name : pathvc[1] Details:0x804c221 "/usr/local/sbin"
Name : pathvc[2] Details:0x804c231 "/usr/local/bin"
Name : pathvc[3] Details:0x804c240 "/usr/sbin"
Name : pathvc[4] Details:0x804c24a "/usr/bin"
Name : pathvc[5] Details:0x804c253 "/sbin"
Name : pathvc[6] Details:0x804c259 "/bin"
Name : pathvc[7] Details:0x804c25e "/usr/games"
However when I pass pathvc in the lookup function, I am getting this:
Name : dir Details:0xbffff0a8 Default:0xbffff0a8 Decimal:3221221544 Hex:0xbffff0a8 Binary:10111111111111111111000010101000 Octal:027777770250
Name : *dir Details:0x804c208 "/usr/lib/lightdm/lightdm"
Name : **dir Details:47 '/'
Why is it that I am passing an array of pointers to the lookup function which accepts it as a double pointer but it is only pointing to the first path instead of complete list of paths.
Pardon me if I am doing/asking a very silly question because I am not comfortable with pointers in C.