On Wed, 30 Jun 2010 23:40:06 -0600, Michael Torrie wrote:

> Given "char buf[512]", buf's type is char * according to the compiler
> and every C textbook I know of.

No, the type of "buf" is "char [512]", i.e. "array of 512 chars". If you
use "buf" as an rvalue (rather than an lvalue), it will be implicitly
converted to char*.

If you take its address, you'll get a "pointer to array of 512 chars",
i.e. a pointer to the array rather than to the first element. Converting
this to a char* will yield a pointer to the first element.

If buf was declared "char *buf", then taking its address will yield a
char**, and converting this to a char* will produce a pointer to the first
byte of the pointer, which is unlikely to be useful.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to