Saturday, March 9, 2013

Program to print Hello

Welcome to the world of C Programming

Before you see this most basic program you should know :

Header file :
In easiest manner we can say that a header file contains definition of predefined functions and macros. Extension of a header file is .h.
We have many header files in directory of C compiler. Most common of them are "stdio.h" and "conio.h" .
We use two type of syntax to use these header files-

  • #include<filename.h>
  • #include"filename.h"
If we want to use any predefined function then we can use header file associated with that function.
For example if we want to use printf() or scanf() function then we have to include stdio.h because these functions are defined in this header file.

Syntax is referred as grammar or rules to use a programming language.

Predefined word means already defined in Compiler Library.


Now check this program this will print "Hello" word on the output screen:

In this above program we used three predefined functions clrscr(), printf() and getch().

  • clrscr() function clears previous output of output screen. It works same as the cls command in we use in DOS.
  • Whatever we will type in double quotes of printf() function it will be displayed on output screen.
  • And the third function is getch(). It stops or freezes the output screen until user presses any keyboard key. Two terms getche() and getchar() also used simultaneously with getch(), see the comparative study of then here.

1 comment:

Powered by Blogger.