![]() ![]() If this bit is 0, the number is positive, and if it is 1, the number is negative. Therefore, out of the allocated memory space for integers, the leftmost bit is reserved for the number sign. ![]() Out of this, 1 bit is reserved for sign (-or+) and remaining 15 bits can contain 0 or 1. Here we have subtracted 1 from the upper limit of the range because 0 is also included.įor example : A variable of int type requires 2 bytes (= 2 x 8 = 16 bits). Here, 1 has been subtracted as one bit is reserved for the signed bit and the remaining for the magnitude. This range can be calculated by using the formula -2 x-1 to +2 x-1 -1 where x is the total number of bits used to store the signed integer type. The range of values that variables of this type can hold lies between -32768 to +32767. it can be used to store both positive as well as negative values. They generally require 2 bytes of memory for their storage. In C, the keyword int is used to represent integer quantity. Integers are whole numbers without a fractional part. They are argumented by using data type qualifiers such as short, long, signed and unsigned. All the C compilers support five Primary(Built-in) Data Types, namely int, char, float, double and void.
0 Comments
Leave a Reply. |