0
What's wrong with that function?
It says that it's not declared. I don't understand why. https://code.sololearn.com/cKwIG3HuR7kJ/?ref=app
4 odpowiedzi
+ 2
It reads from top to bottom, by the time it gets to
u (x, y, z, p);
It hasn't seen the declaration yet so it has no idea what it is and gives you an error.
You can implement the function before main or use a protoype
the prototype lets the compiler know that a function exists somewhere.
Simply copy the function declaration and copy it above main and follow it with ; instead of {}
//Note the argument variable names are optional so
//int u (int, int, int, int);
int u (int a, int b, int c, int d);
int main()
{
//...
}
int u (int a, int b, int c, int d)
{
//...
}
+ 1
Thanks guys! But I just found that my function is faulty. I have to fix it.
0
Put the function before the main function.