Description
The int, unsigned int and signed int types are integer data types. The int type is a synonym for signed int (except in the case of bit-fields, where the signedness of int is implementation-defined.
An int consists of zero or more padding bits, a sign bit (unless it is unsigned), and at least 15 value bits. Thus, the range of an int is at least -32767 to +32767, and the range of an unsigned int is at least 0 to 65535. These are minimum (scalar) values. The actual range of an int in any given implementation is indicated by the macros INT_MIN to INT_MAX, defined in limits.h. The range of an unsigned int in a given implementation is 0 to UINT_MAX.
The printf format specifier for an int is %d. The following program defines an int, assigns a value to it, prints the value, and terminates.
#include <stdio.h> int main(void) { int i = 6; printf("The value of i is %d\n", i); return 0; }
The output of this program is:
The value of i is 6
See also
References
- ISO C99 Standard, 6.2.5