C Programming Integer Data Types

Hey my name is Junaid Shahid. I will like to explain today about the c programming integer data types. In my past post when I have explained about the c programming datatypes. There is basic datatype point, which I have two parts one is integer and other one is floating point datatype. I can say that floating point is derived from the integer datatype. According to some developers and programmers integer datatype is the parent type of floating point.

Introduction

All the arithmetical values expect of decimal and float type are considering as integer datatype. Like if will want to define the value “10”,”12”,”22” then I have to declare the integer type variable with suitable identifiers so that I can recognized them. Almost every program and code have at least one integer datatype variable. From this statement you can judge the importance of integer data types in programming languages. Almost every computer programming language has same syntax of declaring the integer datatype.

I am familiar will C++,Java & C# which have the same syntax. I am not sure about the others programming languages.

This is the chart of integer datatype, which is showing their range, storage capacity and types.

Type Storage size Value range
char 1 byte -128 to 127 or 0 to 255
unsigned char 1 byte 0 to 255
signed char 1 byte -128 to 127
int 2 or 4 bytes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295
short 2 bytes -32,768 to 32,767
unsigned short 2 bytes 0 to 65,535
long 4 bytes -2,147,483,648 to 2,147,483,647
unsigned long 4 bytes 0 to 4,294,967,295

I am also sharing sample code of declaring and defining some types of integer datatypes.

Conclusion

I have tried to convey c programming integer data types. Hope this post is very helpful for you to learn integer data types. Brief chart is also given to understand the storage capacity of different types. If you saw any ambiguous content please let me know. You can comment your views and join my Facebook group. If you have any kind of problem regarding integer data type you are warmly welcome to ask.

SEMrush

LEAVE A REPLY

CommentLuv badge