Re: My problem in C
So I was trying to solve this problem about evaluating expressions on CodeWars, and I did actually managed to code the solution.
Except that the solution I coded is giving me an error with which I am unfamiliar with, (The error is described below,) and I am not sure how to look that up on the google.
As an experiment, I tested my solution with a full program, (CodeWars only gives you the functions to solve,) and my solution is working in my system without error, so I am not sure what is wrong.
Below I have given the entire program, with the line which is giving me error having a comment just after it describing what the error is.
#include <stdio.h>
int expression_matters(int, int, int);
int main(void)
{
int r, a, b, c;
printf("Enter three values:");
scanf("%d%d%d", &a, &b, &c);
r= expression_matters(a, b, c);
printf("%d is the largest value of this _expression_.", r);
return 0;
}
int expression_matters(int a, int b, int c)
{
int d, e, f, g;
d = a* (b+c);
// Above line gives the error called object type 'int' is not a function or function pointer.
e = a * b * c;
f = a * b +c;
g = (a + b) * c;
if(d > e &&
d > f &&
d > g)
{
return d;
}
if(e > d &&
e > f &&
e > g)
{
return e;
}
if(f > d&&
f > e &&
f > g)
{
return f;
}
if(g > d &&
g > e &&
g > f)
{
return g;
}
}
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector