First Program in C
In this tutorial lets create a program to print some welcome message using C program.
All C programs will have to import the header files initially to use the build in functions of the header files. Here we will import the studio.h
file to print the message using the printf()
function.
Next, every C program must contain a main()
function. The main()
function is the entry point of any C program. It is the point at which execution of program is started. When a C program is executed, the execution control goes directly to the main()
function. Every C program have a main()
function.
Example
#include<stdio.h>
int main()
{
printf("Welcome to C programming.");
return 0;
}
Output
Welcome to C programming.
In the above example, the return type of main()
function is int
. So the main()
function returns 0.
We can also use void before the main()
function so that the main()
function does not return any value.