K
kevin.eugene08
Hello all,
Forgive the somewhat simple question I am sure this will be, but I am
having some problem understanding what: char **argv looks like. For
instance, i know through trial and error that if I do this:
#include <stdio.h>
int main(int argc, char *argv[])
{
int l;
for( l=0; l<argc; l++ )
{
printf("Pointer: %p\tValue: %s\n", argv++, *argv);
}
return 0;
}
And i invoke the above as:
../foo one two three
Then I will see:
0x10202 foo
0x10204 one
0x10208 two
ox1020c three
Listed, but I would have expected to have needed to write:
*(*(argv))
So as to dereference what the pointer that *argv pointed to. Or have
I missed the point?
Thanks.
Kevin
Forgive the somewhat simple question I am sure this will be, but I am
having some problem understanding what: char **argv looks like. For
instance, i know through trial and error that if I do this:
#include <stdio.h>
int main(int argc, char *argv[])
{
int l;
for( l=0; l<argc; l++ )
{
printf("Pointer: %p\tValue: %s\n", argv++, *argv);
}
return 0;
}
And i invoke the above as:
../foo one two three
Then I will see:
0x10202 foo
0x10204 one
0x10208 two
ox1020c three
Listed, but I would have expected to have needed to write:
*(*(argv))
So as to dereference what the pointer that *argv pointed to. Or have
I missed the point?
Thanks.
Kevin