Initialization of a Variable with Datatype

 Program:

#include<stdio.h>
#include<conio.h>
void main()
{
    int n=100;
    clrscr();
    printf("\nValue of n=%d", n);
    getch();
}

Output:

Value of n=100

Definitions:

#include<stdio.h> :

                It is a preprocessor file which include the header file of stdio.h(standard
input output ) header file. In these header file contains the functions of printf(), scanf(),
etc.,

#include<conio.h> :

                It is a preprocessor file which include the header file of conio.h(console
input output ) header file. In these header file contains the functions like clrscr(), getch(),
etc.,

void main(){} : 

                In these Main function we can write our entire program with statements.

                void => It tell is an Empty argument

printf   :      

   It is a function and is  used to print data on the standard output device
(monitor).

int: 

                It is positive, negative and whole values but not a decimal number.
               Eg: 10, 20, 45,-30, 0 etc.

clrscr() :

                This function clears the console screen of any previous outputs so that the
output of the program currently executed alone is visible on the console screen.

getch() : 

                 The function getch() basically stands for "get character". The getch()
function is usually used to hold the output screen until the user presses on the keyboard,
i.e., the case of pressing key to continue.



Next Topic        :  Initialization of all Data Types

Previous Topic :  Variable

No comments:

Post a Comment