C Programming language

adplus-dvertising
Function declaration and prototype in C
Previous Home Next

Function Declaration and Function Prototypes

C always needs declaration before use. This is also true for functions. For functions the declaration needs to be before the first call of the function. A full declaration includes the return type and the number and type of the arguments. This is also called the function prototype.

For Example :

int add( int, int);

This statement declares a function called add, it has two integer arguments and returns an integer.

Main Function In C

A main function is placed where the execution of the starts. main() cannot return anything.

Can I run a program in c without main if yes how? Answer is "NO".

The reason is, main() is a function called by another function, which is the start-routine. This routine is created by the compiler and will be same for all the programs that you write.

Previous Home Next