[time-nuts] GPIB on HP5382B counter
Magnus Danielson
magnus at rubidium.dyndns.org
Sat Oct 24 20:53:20 UTC 2009
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
More information about the Time-nuts_lists.febo.com
mailing list