3 ms·
> I don't think anything can return an lvalue in C. Btw, I was curious to check , here is an example of a function returning an lvalue: struct test { in
by simiones 6y ago
> I don't think anything can return an lvalue in C.
Btw, I was curious to check , here is an example of a function returning an lvalue:
struct test {
int a;
} global;
struct test* foo() {
return &global;
}
int main (int argc, char**argv) {
printf("%d", global.a); //wil print 0
foo()->a = 9;
//or (*(foo())).a = 9;
printf("%d", global.a); //will print 9
}