On Sun, 19 Oct 2003 20:20:54 GMT, "Mike Wahler"
<mk******@mkwahler.net> wrote:
"batee5a" <ra*******@hotmail.com> wrote in message
news:5c************************@posting.google.co m... what is the difference between char* and char[]?????
In the context of a function parameter, nothing,
they both mean 'pointer to char'
In a declaration other than a function parameter,
The former signifies a pointer, the latter is
a syntax error.
Hmmm...
I think the OP was thinking about this:
const char msg[] = "Hello";
or this:
char buffer[256];
as opposed to this:
const char * msg = "Hello";
or this:
char * buffer;
(rather than "char[]", which doesn't compile, of course).
You can cast an array to a pointer, but not the other way around.
You can perform "pointer arithmetic" on a pointer, but not on an
array, i.e.:
char buffer[256];
char * pc = buffer; //OK: pc == &(buffer[0])
++pc; // OK: pc == &(buffer[1])
++buffer; // error
--
Bob Hairgrove
No**********@Home.com