int main ( int argc, char **argv ){}
int main ( int argc, char *argv ) {}
Quote:
An array of char pointers can be represented as a function parameter one of two ways: char *name[] or char **name. I have chosen to use the latter, you can use either one, it is a matter of style, which I refuse to dictate
#####################
In the code you quoted, the former is correct, the latter is wrong. (But since this is C, both main functions should return 0.)
Under certain circumstances, an array decays to a pointer to its first element. In that way, char **argv and char *argv[] are equivalent.
#####################
char *argv .. u r sending a pointer to a char as an argument..this can be a normal pointer or point to a array of chars...
char **argv .. u r sending a pointer to an array of pointers as an argument . which means, each element of this array can itself point to a char array..
Wednesday, 19 November 2008
Assigning in C
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment