Newsgroups: comp.lang.c
From: Keith Thompson <ks...@mib.org>
Date: Sat, 05 Jul 2008 18:04:09 -0700
Local: Sat, Jul 5 2008 9:04 pm
Subject: Re: Understanding char **argv
"kevin.eugen...@googlemail.com" <kevin.eugen...@googlemail.com> writes: argv is of type char**, so *argv is of type char*. > 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[]) > return 0; > And i invoke the above as: > ./foo one two three > Then I will see: > 0x10202 foo > 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 printf() with the "%s" format expects an argument of type char*, Incidentally, "%p" is the correct format for printing a pointer Finally, some style points (oh, here goes Keith with his "style "l" isn't a great name for a variable; it looks too much like the Some would argue that modifying a function argument is poor style. Of course none of this is a big deal for a program this small, but -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||