Functions
While main() is a function, it is an unusual one, because it is called automatically when you start your program. All other functions are called by your own code as the program runs.
A program is run line by line starting at the top of main, until another function is called. Control is then transferred to that function. When that function finishes, it returns control to the line after its call in main. If the function you call in turn calls another function, control flows in the same way—returning to the line in the first function that follows its call to the other function.
Even if a function is defined above main in the listing (you'll see this later), it is not performed before main. main always runs first.
Functions either return ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access