Beta Coder

Learn code like Beta Coder.

Breaking

Thursday, January 9, 2020

C "Hello World" Basic Program


C Hello World Basic Program


C "Hello World" Program
In this example you will learn to print "Hello World!" on the screen in C programming.

You can use Dev c++ then you use bellow code.
#include "stdio.h"
int main() 
{
   // printf() display the string inside quotation 
   printf("Hello World!");
   return 0;
}
Output:
Hello World!
You use other turbo c software then you use bellow code
#include "stdio.h"
#include "conio.h"
int main() 
{
   // printf() display the string inside quotation 
   printf("Hello World!");
   getch();
   return 0;
}
Output:
Hello World!


How "Hello World!" program works?

In this program the #include is a preprocessor command that tells the compiler to include the contents of stdio.h file in the program.
In this program the stdio.h file contains functions such as printf() to display output respectively.
If you use the printf() function without writing #include <stdio.h>, the program will not compile.
The execution of a 'C' program starts from the main() function.
In this program printf() displays Hello World! text on the screen.
The return 0; statement is the "Exit status" of the program. In simple terms, the program ends with this statement.

No comments:

Post a Comment