Why does Bucky every time prototype the function instead he can declare the function before main(). Why does he do that every time?
Post a Reply
|Oldest Newest Rating|
· 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.
· 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.
· 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.
Used in many types of software including music players, video games, and many large scale applications.
|Bucky Roberts Administrator|