. Advertisement .
..3..
. Advertisement .
..4..
I get an error:
10:11: error: called object is not a function or function pointer
z=(x^y)+2(x&y);
^
when I try to run the following code:
z=x-~y-1;
printf("%d",z);
z=(x^y)+2(x&y);
printf("%d",z);
z=(x|y)+(x&y);
printf("%d",z);
z=2(x|y)-(x^y);
printf("%d",z);
How to fix the called object is not a function or function pointer. Please give me some good ideas.
The cause:
2(x&y)
asks the compiler to call the function2
, passing an argumentx&y
(just asprintf("hi")
, it means “callprintf
and pass an argument"hi"
“). However,2
is not a function, so it causes an error. A function call is a syntax call when you have(
followed by a value.Solution:
Replace
by
and
by
If multiplication is what you planned, you need to have a multiplication operator.
Change
To
And
To
If multiplication is what your goal is, you will need the multiplication operator.