It is the address of the variable. The value is stored in the variable itself, not referenced from it.
I think you may have been confused by the word "object"?
When we are talking about C, "object" does not have the same meaning as in for example Python or Java. In C, it means a memory location, not a value. The (draft C11) standard defines an object as "a region of data storage in the execution environment, the contents of which can represent values", so it is the variable itself that is called an "object".
If you do a similar thing in C++, it is the same thing:
MyStruct myvar = MyStruct();
foo = &myvar;
In this code snippet, you still get the address of the variable. C++ is not like Java, where similar code would create a variable that contains the address (in Java called a "reference") of an object, that is stored elsewhere. In C++, the MyStruct
instance is stored in the variable.
To get C++ to work like Java, and store the MyStruct
instance elsewhere in memory, you need to use explicit pointers:
MyStruct* myvar = new MyStruct();
foo = &myvar;
But the operator &
will still give you the address of the variable, not of the MyStruct
instance! To get the address of the instance, just use myvar
, without the operator.