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

11th Jul 2017, 11:37 AM
Γιάννης Δημητριάδης
Γιάννης Δημητριάδης - avatar
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) { //... }
11th Jul 2017, 11:47 AM
Dennis
Dennis - avatar
+ 1
Thanks guys! But I just found that my function is faulty. I have to fix it.
11th Jul 2017, 12:09 PM
Γιάννης Δημητριάδης
Γιάννης Δημητριάδης - avatar
0
Put the function before the main function.
11th Jul 2017, 11:48 AM
Boris Batinkov
Boris Batinkov - avatar