Not really, if you want to print out the memory address (a pointer value), I'd use the correct format:
printf("The address is: %p\n", &array);
For example, %x
will just print the hex-value for whatever int is passed as the corresponding argument. Once you've done that, all three statements print out exactly the same:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char foo[] = "Some string";
printf("%p\n%p\n%p\n", (void *)foo, (void *)&foo, (void *)&foo[0]);
return 0;
}
Prints out the same thing, three times.
As H2CO3 kindly pointed out, you will need to cast to a void pointer for printf, though
Usually, an array evaluates to the address of its first element. That's why array
, &array
and &array[0]
all churn out the same value. You can read all about it here