Additionally, (as you know, but merely pointing out for the curious), `sizeof arr` returns the size of arr in bytes, not the size of a pointer to the first element of arr.
Does this compile? I thought an array was treated like a constant pointer, inexistent in memory so you cannot take its address, increment it, or attribute it another value. Although the point made by RegEx about sizeof, which I didn't remember, convinced me that an array is not actually a constant pointer.
To make my thoughts clear, if arr is equivalent to &arr[0], then wouldn't &arr be equivalent to &&arr[0]?
Comments
Just as with pointer arithmetic (because that's what this actually is) you don't multiply by the size of its elements. This:
is the same as this: The compiler knows what the type of data the pointer refers to and can produce the byte offset itself. Also: Eh... an array can degrade into a pointer when needed, but what does the following produce? Is "x" a pointer to pointer to char? From your assessment it would seem so, but in reality the type of "x" is i.e., pointer to array of char 10. An array is an array, and arrays can degrade into pointer types.Additionally, (as you know, but merely pointing out for the curious), `sizeof arr` returns the size of arr in bytes, not the size of a pointer to the first element of arr.
To make my thoughts clear, if arr is equivalent to &arr[0], then wouldn't &arr be equivalent to &&arr[0]?