I have this program and I'm getting:
lvalue required as left operand of assignment
because of the line function_a = function.
int function_a(int j){
return j+10;
}
int function_b(int j){
return j;
}
void set_a(int (*function)(int)){
function_a = function;
}
int main(){
int a = function_a(2);
printf("%d, ", a);
set_a(function_b);
int b = function_a(2);
printf("%d", b);
}
I want to set function_a to function_b in function set_a. So I'm expecting output 12, 2. What I should do to assign this properly?