MCS-011 Problem Solving and Programming

First year, Semester 1

Chapters

Newsletter

Data Type Qualifier

Short, long, signed, unsigned are called the data type qualifiers and can be used with any data type. A short int requires less space than int and long int may require more space than int. If int and short int takes 2 bytes, then long int takes 4 bytes.

Unsigned bits use all bits for magnitude; therefore, this type of number can be larger. For example signed int ranges from –32768 to +32767 and unsigned int ranges from 0 to 65,535. Similarly, char data type of data is used to store a character. It requires 1 byte. Signed char values range from –128 to 127 and unsigned char value range from 0 to 255. These can be summarized as follows:

Data TypeSize (bytes)Range
Short int2-32,768 to 32,767
int2-32,768 to 32,767
Signed int2-32,768 to 32,767
Unsigned int20 to 65,535
Long int4-2,147,483,648 to 2,147,483,647
Signed char1-128 to 127
Unsigned char10 to 255

 

Report an issue

Reporting: Data Type Qualifier (topic)

Related Posts