Any program source has to identify a memory location as the start of the program. The OS transfers control to this point of the program or module.
In case of C programs, the starting module is NOT your program, but another initialisation routine, which has name lis c0s.obj, c0l.obj etc. This routine after doing initial housekeeping work, like storing program name, arguments, environment variables etc. in the stack, calls a routine by name main.
How else are we going to tell the OS where to start ?
At the end of executing the main() function, the control goes back to the routine from which the main was called and then to OS, which terminates the program.
No. At minimum, you need to provide a main() function.
Nothing, it is a security hole. Use 'fgets' instead.
Actually, it is:int main (void)orint main (int, char **)the point where the execution of the program begins
The c language does not have template functions. That is a c++ thing.
The execution of the program starts with function main, wherever it is in the source.
No, it should be int type or void.
It start with function - main()
Because if you donot use main function in c program, the compiler willnot execute the program.C compiler starts execution from main function itself.
No. At minimum, you need to provide a main() function.
Yes
You can use the pow() function in math.h.
To specify the return-type of the function.
It's called 'main' by tradition; this feature lets the linker to know, where to start the execution.
it returns nothing
The main function defines the entry point of an application in C.
You cannot have a function named else, because it is a reserved word.
Use the atoi() or atol() function.