Confusion about an error: lvalue required as unary '&' operand [duplicate]
问题 This question already has answers here : Not able to understand error condition wrt lvalues (3 answers) Closed 5 months ago . I have been trying to understand pointer concepts by writing simple code, and I got an error problem, and it seems like I couldn't solve it or understand it. #include <stdio.h> int *foo(void); int main(void) { printf("%d\n", *foo()); return 0; } int *foo(void) { static int num = 1; ++num; return &(++num); } Here is the error message. error: lvalue required as unary ‘&’