Revisiting the main() function
The main()
function is, as we have seen, the first place our program begins execution. Recall that before execution begins, various kinds of memory are allocated within our program space. Once the memory is allocated and initialized, the system calls main()
, pretty much as we might call any other function. In this regard, main()
is a function like any other.
The special features of main()
On the other hand, main()
is not just another function in C. The main()
function is a special C function with the following unique properties:
main()
cannot be called by any other function.main()
is activated as the first function called when the program is invoked to begin execution.- When we return from the
main()
function, execution stops, and the program is terminated. - There are only two forms of the
main()
function prototype:- Has no arguments...