Home / Computer Courses / Integer Data Types in C++ Languages

Integer Data Types in C++ Languages

Integer Data Types in C++ Languages

Integer Data Types:

Numeric values are integer data types. This type of data has no decimal point or fraction. It includes positive and negative values. The minus sign ‘-‘ uses to show the negative value. If no sign use with the value then the value will positive value by default.

integer data types

Example:

Some integer values are 12, 570, and -30 etc.

Now we discuss the types of Integer data type.

Types of Integer:

C++ language provide different types of integer data that are:

Data Types Range Size  
int -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 2 or 4 bytes
short -32,768 to 32,767 2 bytes
long -2,147,483,648 to 2,147,483,647 4 bytes
unsigned int 0 to 65,535 or 0 to 4,294,967,295 2 or 4 bytes
unsigned short 0 to 65,535 2 bytes
unsigned long 0 to 4,294,967,295 4 bytes

   1)   int Data Type:

int data type uses to store integer values. The C++ language does not specify the size of int. The size is depend on the computer or compiler that is using. It mostly takes two or four bytes in memory.

int_min use to present the smallest value that can be stored in int data type. int_max use to present the largest value that can be stores in int data type. int_ min and int_max are define in limits.h header file.

 

Before Going Next, We Have Some Recommended for you!!!

 

   2)   short in Data type:

short int data type use to store integer values. It take two bytes in memory. Its range is -32768 to 32767.

shrt_min use to present the smallest value that can be store in short int data type. shrt_max use to present the largest value that can be stores in short int data type. shrt_ min and shrt_max are define in limits.h header file.

   3)   long int Data type:

long int data type use to store large integer values. It takes 4 bytes in memory and its range is from -2,149,483,648 to 2,147,483,647. long_min use to present the smallest value that can be store in long int data type. long_max use to present the largest value that can be stores in long int data type. long_ min and long_max are define in limits.h header file.

About Shumaiza Asghar

Shumaiza Asghar

Check Also

errors and types of errors

Error And Types Of Errors in C++ Language

Error And Types Of Errors in C++ Language Errors: Error in a program known as …

Leave a Reply

Your email address will not be published. Required fields are marked *