This question might be very basic but i post here only after days of googling and for my proper basic understanding of signed integers in C.
Actually some say signed int
It depends on your environment and typically int
can store -2147483648 to 2147483647 if it is 32-bit long and two's complement is used, but C specification says that int
can store at least -32767 to 32767.
Quote from N1256 5.2.4.2.1 Sizes of integer types
Their implementation-defined values shall be equal or greater in magnitude (absolute value) to those shown, with the same sign.
— minimum value for an object of type int
INT_MIN -32767 // −(2 15 − 1)
— maximum value for an object of type int
INT_MAX +32767 // 2 15 − 1`