C Programming - The First Program

My First C Program.

I can't wait to execute... Let's Begin

Before we begin, let's talk about program. First we make simple program which prints a simple message as you want.
I Like to print 'Hello Devil' on my Screen.

One more - The File which is stored our program is saved with '.c' extention.
For ex, I want to save my File as 'HelloDevil'. so, i simply put '.c' after the name Like 'HelloDevil.c'

Let's Start...

Program - HelloDevil.c

#include<stdio.h>
#include<conio.h>
void main()
{
	clrscr();
	printf("Hello Devil.");
	getch();
}

Output:

 Hello Devil. 

Program Explaination:
The First main thing is to add header files, without it we can't run our program.
The first Header file we uses is a <stdio.h> which is a standard input output header file which contains all the functions related to input and output.
2nd is <conio.h> is used for Console input and output and it's not part of the C Standard Library. it is mostly used by MS-DOS Compilers which contains functions related to console input and output.
Two of them we have used in our program. 1) clrscr() and 2) getch().
The C Program always starts an excecution from the main() function as we discussed in previous post it is a heart of the program.
clrscr() - it clears the previous output from the screen.Try it by removing it from the code and see the output.
getch() - it is holds the current output on the screen

Note: clrscr() is only used in console based app like MS-DOS.

Previous Post
C Programming : A Journey Begins
Next Post
C Programming : Syntax of C Program

Comments

Popular posts from this blog

Syntax of C Program