I’m doing a simple challenge for a programming book that’s asks to output the result of the formula f = (a − b)(x − y) using a single printf() function. and I get this Error: “error: called object ‘a – b’ is not a function”
Here is the code:
#include <stdio.h>
main()
{
int a = 5;
int b = 1;
int x = 10;
int y = 5;
printf("\nThe result of f = %d\n", (a-b)(x-y));
}
Are you trying to multiply? If so, change:
to
That ‘*’ is critical. It’s the multiplication operator. The extra parens around the whole thing aren’t really required, I just like to be neat by tying the whole equation up inside them.