[Solved] How do I fix/debug a “lvalue required as left operand of assignment” error?


Try something like that:

#include <stdio.h>
#include <math.h>

// functions shall be defined here
float lift_a_car(int r1, int m1, int m2)
{
    // note to get a float result, you need to cast to float
    return (r1 + (2 * (float)m1 / (m1 + m2)));
}

int main() {
    // Here you can call the function
    printf("%.4f\n", lift_a_car(2, 80, 1400));

    return 0;
}

solved How do I fix/debug a “lvalue required as left operand of assignment” error?