C

Simple C Program: Hello Word!

This is a Simple C Program which prints "Hello Word!"...

//Write a Simple C Program Which prints Hello World.
#include<stdio.h>
#include<conio.h>
void main()
{
    printf("Hello World");
    getch();
}

Output:

Command Prompt
Hello World

This program uses printf function to print Message.

Different parts of C program.

  • Pre-processor
  • Header file
  • Function
  • Variables
  • Expression
  • Comment
All these are essential parts of a C language program.

Pre-processor

#include, the first word of any C program. It is also known as pre-processor. The main work of pre-processor is to initialize the environment of program, i.e to link the program with the header file <stdio.h>.

Header file

Header file is a collection of built-in functions that help us in our program. Header files contain definitions of functions and variables which can be incorporated into any C program by pre-processor #include statement. Standard header files are provided with each compiler, and cover a range of areas like string handling, mathematical functions, data conversion, printing and reading of variables. To use any of the standard functions, the appropriate header file must be included. This is done at the beginning of the C source file. For example, to use the printf() function in a program, the line #include <stdio.h> is responsible.

Function main()

main() function is a function that must be used in every C program.
A function is a sequence of statement required to perform a specific task.
main() function starts the execution of C program.
In the above example, int in front of main() function is the return type of main() function. we will discuss about it in detail later.
The curly braces { } just after the main() function encloses the body of main() function.

Variables

Variable will explain in later in next tutorial.

Expression

expression also will explain later...

Comment

Comments are simple text in your C program that increases readability of programs. Compiler ignore anything written as comment in your program.

//This is valid Single line Comment

/*This is also valid Single line Comment*/

/*-------------------------------------------
 This is a long and valid Multi line Comment
--------------------------------------------*/



Subscribe us on Youtube

Share This Page on

Questions


Heli Acharya | 28-Apr-2016 10:14:00 pm

This is really easy and helpful to all the students for learning C Language. Thank you for getting this to us.


Sagar solanki | 17-Jun-2016 10:28:56 am

Very clean and beautiful site with lowests load.... beautiful design


kalyani tripathi | 07-Sep-2018 07:59:08 pm

create a program for hello world without using any header files & any loops


zala siddhrajsinh | 20-Feb-2019 10:25:22 pm

create for loop program


Ask Question