I know you've been told they are the same by now, which is right, but I though I'd add the why of
the two forms.
There is an argument about which is better between some programmers. Some say that "char* variable;"
is best because the pointer symbol is visibly linked to the char type, so it's clear that you are
declaring a character pointer (a pointer to a character) and not just a character. The others say
that this is misleading as if you write:
char* var1, var2;
it looks like both var1 and var2 are pointers, where as in fact var1 is a character pointer and var2
is just a character, so they say use the second method:
char *var1, *var2; // two pointers
In the end it's a matter of style, both are valid and you can even write (AFAIK):
char * var1; // just to confuse you!
There are other arguments, but I don't bother with any of it and just use what I want.
Even more confusing (<evil laugh>) is that you can write *argv[], or **argv and they are
interchangeable. I'm not sure about argv[][] though - probably invalid.
My two cents, Jason.
----- Original Message -----
From: "Daniel Glenfield" <sp...@ho...>
To: <dev...@li...>
Sent: Sunday, April 07, 2002 12:07 PM
Subject: [Dev-C++] difference between char* argv[] and char *argv[]
Hi all,
what's the difference between char* argv[] and char *argv[] ? imilarly,
char* abc and char *abc ? Are they the SAME because the compiler ignores
whitespace?
Daniel
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|