Posted by: shmuklidooha
Posting time: 4.5 years ago on
Last edit time: never edited.
Archived on: 2/12/2017 1:51:00 AM
Views: 469
SCP: 5
5 upvotes, 0 downvotes (100% upvoted it)
~1 user(s) here now
NSFW: No
Authorized: No
Anon: No
Private: No
Type: Default
view the rest of the comments →
[–] 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.
[–] shmuklidooha [S] ago
Thanks!