What does it mean when error says function should have a prototype???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

What does it mean when error says function should have a prototype????

30th Jan 2017, 4:44 AM
Shivam Hasurkar
Shivam Hasurkar - avatar
3 Answers
+ 2
Simply means that the function you called is written after where you called it from so the program doesnt know about it. you need to give it a prototype so the compiler knows what it is. for example: void myfunction2(); // prototype <--- void myfunction1() { // call my function 2 myfunction2(); } void myfunction2() { cout << "Hello"; }
30th Jan 2017, 5:01 AM
jay
jay - avatar
+ 2
Yes,but how to do that?
3rd Jan 2021, 10:59 AM
Shamira Khatun
Shamira Khatun - avatar
+ 1
If your Program has a function and the definition of that function is given after main() then you will have to give a prototype of that function before main() function so that the compiler does not get confused.
30th Jan 2017, 8:16 AM
Arpan Lunawat
Arpan Lunawat - avatar