This is a theoretical question.
I wonder how certain constructions in C are performed internally without references. For example:
struct Foo { int a; };
int main() {
struct Foo foo;
foo.a = 10;
return 0;
}
What is the type of foo.a? It’s definitely not a pointer, because we assign 10 as a value, not address. But it’s not a value type as well, because it changes data of foo. In C++ I would just say that it’s a reference, but in C?
It is an int lvalue. Same as if you had
int bar, andbar = 10changes the data ofbar. Same applies to any element within an array. Basically anything you can take the address of is an lvalue.Lvalue status is independent of type.