About us

Main Function in C

Main Function in C

main-function-c

The main function is the entry point of any C Program. It is the point at which execution of the program is started. When is a C program is executed, the execution control goes directly to the main function and basis of main function program control goes to other functions. The only difference between the main function and other function is that it(main function) is called by OS. The main function also contains a return type. It is a datatype which returns to OS. The data type may be void, int, etc.

void main ()
{
    //-------------------
    //-------------------
    //-------------------
}


Void

It is a keyword in c language void means nothing. Whenever we use void as a function return type then that function nothing return. Here main function no return any value in place of void.we can also use int return type.


 Clrscr()

Clrscr() is a function which is predefined in Conio.h(input-output header file) header file. This function is used to clear the console screen. It should be placed after the variable and the function declaration only. Using of clrscr() is optional. This function mainly uses in 16-bit compilers. (like Turbo c++)


Getch()

It is a predefined function in Conio.h(input-output header file) header file. It is used to accept any character from the keyboard.


 ------------------------------------------------------------------------------------------------------------


You can also visit:-