Hal Murray wrote:
If buf is defined as an array (eg. char buf[100];) its name is a
constant that points to the start of the array. You can write it
either as buf, or &buf.
Not quite. You need &buf[0]
buf is a pointer to the array. (first element)
&buf is a pointer to that pointer.
&buf[0] is a pointer to the first element of the array.
Not quite.
Piece of example code:
#include <stdio.h>
int main()
{
int buf[100];
printf("%p %p %p\n", buf, &buf, &buf[0]);
return 0;
}
Prints
0xbf933224 0xbf933224 0xbf933224
So they are the same in this context. That's how it works. I could
detail it in booring details if needed.
Cheers,
Magnus
_______________________________________________
time-nuts mailing list -- [email protected]
To unsubscribe, go to https://www.febo.com/cgi-bin/mailman/listinfo/time-nuts
and follow the instructions there.