Home » , , » Fundamental Data Type - int (Integer)

Fundamental Data Type - int (Integer)

Written By Unknown on Sunday, October 6, 2013 | 7:29 AM

Integer Data Type :
Integer is the first Fundamental Data Types among the four.Integer means whole numbers like 1,5,10,345,1257 etc.The short form of Integer is "int". int type variable is use to express whole numbers in C - Program.It takes 2 byte( 16 bit ) memory in a C - Compiler.

Ex : int i;

Here i is announced as an int type variable.The highest value for an int type variable is
+32767 and the lowest is -32768

Watch the program carefully :

1.#include<stdio.h>
2.#include<conio.h>
3.main()
4.{
5.int i;
6.i=32767;
7.printf("The value of i is %d",i);
8.i=42787;
9.printf("\nNew valu of i is %d",i);
10.getch();
11.}


OUTPUT :

The value of i is 32767
New value of i is -22876

Program Analysis :
As "i" is declared as an int type variable so the highest value of i is 32767 and it is printed in our computer screen as exact but when we put the value of i higher than it can contain so the error occurred and the second value of i is irrelevant.

So we must be conscious when ever we need to work with int type variable and we also keep in our mind the highest and the lowest value of an Integer Type Data.  


Share this article :

Post a Comment

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Learn Programming - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger| Distributed by Rocking Templates