I have the given code, which gets an error:
error: invalid initialization of non-const reference of type 'int&' from an rvalue of type 'int' const int b = f(a++); ^
int f(int& a)
{
return a;
}
int main() {
// your code goes here
int a = 5;
int b = f(a++);
std::cout << b << std::endl;
return 0;
}
What the cause of this error ?