When I declared a variable
char buf[512];
What does mean &buf ?
It seems equals to buf :
printf(" buf :  %p %p\n", (void *) buf, (void *) &buf);
prints :
buf :  0x7ffda6053fe0 0x7ffda6053fe0
When I declared a variable
char buf[512];
What does mean &buf ?
It seems equals to buf :
printf(" buf :  %p %p\n", (void *) buf, (void *) &buf);
prints :
buf :  0x7ffda6053fe0 0x7ffda6053fe0
 
    
     
    
    it is the address of the 1st element in the array (i.e. address of buf[0]) vs. the address of the array itself (i.e. buf). No big surprise that they are equal.
 
    
    The address is the same because an array decays into a pointer to the first element when passed, on the other hand, the address-of operator & takes the address of the array, the address of the first element and the address of the array itself are the same.
Use %p instead of %d to print addresses:
printf(" buf :  %p %p\n", (void *)buf, (void *)&buf);
