C Simple C Program

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
--------------------------------------------*/

Share This Page to Download:

Share to Download

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


Ask Question