Integer Data type :
An integer is a whole number (a number without a fractional part). It can be positive or negative numbers like 1, -2, 3, etc., or zero. The sizes of the integer variables depend on the hardware and operating system of the computer. On a typical 16-bit system, the sizes of the integer data type are as follows.
INTEGER DATA TYPE SIZE :
TYPE | Bytes | Possible Values le Values |
int |
2 or 4 |
-32,767 to 32,767 |
unsigned int |
2 or 4 |
0 to 65,535 |
signed int |
2 or 4 |
-32,767 to 32,767 |
short int |
2 |
-32,767 to 32,767 |
unsigned short int |
2 |
0 to 65,535 |
signed short int |
2 |
-32,767 to 32,767 |
long int |
4 |
-2,147,483,647 to 2,147,483,647 |
signed long int |
4 |
-2,147,483,647 to 2,147,483,647 |
unsigned long int |
4 |
0 to 4,294,967,295 |
C – INTEGER DATA TYPE EXAMPLE PROGRAM :
1 2 3 4 5 6 7 8 9 10 11 |
#include<stdio.h> #include<conio.h> int main() { int a; clrscr(); a = 10; printf(“Value of a = %d”,a); getch(); return 0; } |
Output :
Value of a = 10 |