Most of what I\'ve read about the address operator, &, says it\'s used to get just that - an address. I recently heard it described differently, though, as
The & operator simply returns a pointer to its operand. If its operand was an int the resulting type will be int*. If its operand was an int* the resulting type will be int**. For example, this program:
#include
struct test {
int a;
int b;
int d;
};
int main ( ) {
struct test foo = { 0, 0, 0 } ;
printf( "%lu\n", (unsigned long)(&foo + 2) - (unsigned long)&foo );
}
Outputs 24 on my machine because the sizeof(struct test) is 12, and the type of &foo is known to be struct test *, so &foo + 2 calculates an offset of two struct tests.