Hello World C Program




A simple C program to display "Hello World" on the screen. Since, it's a very simple program, it is often used to illustrate the syntax of a
programming language.

Program to display "Hello World"


#include<stdio.h>
#include<conio.h>

void main()
{
printf("Hello World");
getch();
}

OutPut


Hello World

Description of the above program
  • In C/C++ Language Symbol # is know as preprocessor
  • include is a directory and all the header files like stdio.h, conio.h are kept there.
  • The #include<stdio.h> (Standard input and OutPut) is a preprocessor commond, the command tells the compiler to include the contents of stdio.h in the program. The stdio.h contains the functions like printf() and scanf().
  • conio.h stands for "Console Input Output Header File”, which manages input/output on console based application.
  • The execution of every C Program starts from main() function.




  • The function printf() is a standard library function used to send formatted output to the screen.




  • getch() reads a single byte character from input. getch() is a way to get a user inputted character. It can be used to hold program execution, but the "holding" is simply a side-effect of its primary purpose, which is to wait until the user enters a character.

Comments