logo
C Language First Program
Before starting to learn C language, first of all you need to learn how to write, compile and run the first c program. To write the first c program, open the C console and write the following code .
#include <stdio.h>  
#include <conio.h>
void main()
 {  
  clrscr();  
   printf(“Hello World”);  
  getch();  
 }  
Output :

Hello World

#include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h .

#include <conio.h> includes the console input output library functions. The getch() and clrscr() functions are defined in conio.h file.

void main() The main() function is the entry point of every program in c language. The void keyword specifies that it returns no value.

clrscr() If you run the c program many times, it will append the output in previous output. But, you can call clrscr() function to clear the screen. So it will be better for you to call clrscr() function after the main method.

printf() The printf() function is used to print data on the console.

getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.