C Language Q & A #12 (cont.)
- It is like the difference between a one-way ticket and a round trip ticket on the LIRR.
- The round trip ticket lets you return to your starting point. Functions work in the same way. You send your program into a function, and then you return from that function, back to where you started (in the program).
- The function main has some special properties in a C program
- It is the starting point for running your program, so it is “called” by DOS (when you type the name of the program and press enter outside the IDE)
- A function in C can return a value to the calling program. In the case of main(), the calling program is DOS, so you can return a value back to DOS, which DOS can use or ignore. For example, DOS batch commands can use the value returned from a program to make decisions between alternative actions.