You are viewing a single comment's thread.

view the rest of the comments →

0
0

[–] LoungeAbout ago 

It's really an issue with organizing code.

Every function you are going to use must at least be declared before use, but you don't have to define it's innards until later.

In "real life", you typically are separating out your code into sections or libraries. You would declare a set of related functions and put them together in a header (a ".h" file). You would then define those functions in a source file (maybe ".c"). When you need to change code in one section of your application, you'll only need to re-build that one file before linking together all of your source files.

If you defined the functions before your main, you could potentially have a lot of source code in one gigantic file. For simple programs, I almost always do are you describe: define the code before the main.

0
0

[–] shmuklidooha [S] ago 

Thanks!