While the types of the three are different :
s
is a char[32]
(an array of 32 char
s), which transparently decays to a char*
where needed
&s[0]
is a char*
(a pointer to char
)
&s
is a char(*)[32]
(a pointer to an array of 32 char
s)
they all resolve to the same value (the start address of the character array). So, when passing it to printf
, which expects a char*
, the result will be the same for all 3 (assuming the object representation of a char(*)[32]
is the same as that of a char*
, which is implementation dependent, but commonly the case).
Only the first two are valid though - the third just works by accident.