Why does Bucky every time prototype the function instead he can declare the function before main(). Why does he do that every time?

+2 Raghu Ram · February 4, 2016
Why does Bucky every time declare the function after the main() and prototype it? That is extra work right. Instead he can declare the function before main(). 

Post a Reply


Oldest  Newest  Rating
+2 Rafay Mehfooz · February 5, 2016
I'm not sure why does he do that everytime but If I can guess, I would say he does that because it keeps your code clean, you know which functions you have used, if you have prototyped them in order & declared them respectively, then it could be easy for you to locate those functions, instead of just scolling up & down to find a particular function. ( I know that you can use Ctrl+F to find anything in a program)... in simple words, Its a good practice.
+1 Laura Lee · February 6, 2016
Generally it should be done that the prototypes are stored in header files and the function definitions stored in c/cpp files. 
0 Alf Nohr · February 4, 2016
It's a matter of style. Some programmers like  to have the main function as near the top as possible. So instead of having functions that takes up for example 200 lines above main. Do we just prototype it and get two lines above main, and get the functions itself under.
  • 1



Used in many types of software including music players, video games, and many large scale applications.

Bucky Roberts Administrator