Download
types.c and compile (on Pyrite)
types
using
gcc -ansi -o types types.c
.
By running
./types
you will see the following output:
unsigned char | 1 bytes | 8 bits | 0 to 255 | (0 to 2^8-1)
unsigned short int | 2 bytes | 16 bits | 0 to 65535 | (0 to 2^16-1)
unsigned int | 4 bytes | 32 bits | 0 to 4294967295 | (0 to 2^32-1)
unsigned long int | 8 bytes | 64 bits | 0 to 18446744073709551615 | (0 to 2^64-1)
unsigned long long int | 8 bytes | 64 bits | 0 to 18446744073709551615 | (0 to 2^64-1)
signed char | 1 bytes | 8 bits | -128 to 127 | (-2^7 to 2^7-1)
signed short int | 2 bytes | 16 bits | -32768 to 32767 | (-2^15 to 2^15-1)
signed int | 4 bytes | 32 bits | -2147483648 to 2147483647 | (-2^31 to 2^31-1)
signed long int | 8 bytes | 64 bits | -9223372036854775808 to 9223372036854775807 | (-2^63 to 2^63-1)
signed long long int | 8 bytes | 64 bits | -9223372036854775808 to 9223372036854775807 | (-2^63 to 2^63-1)
float | 4 bytes | 32 bits | 12/10 = 1.20 : 1.20000004768371582031
double | 8 bytes | 64 bits | 12/10 = 1.20 : 1.19999999999999995559
These define the sizes and ranges of the different primitive types in C on Pyrite.
Ranges for
float
and
double
are difficult to describe, so look at the
IEEE Floating Point Specification if you are interested.