C Basic Data Types
C Basic Data Types
Basic data types. The following are typical sizes but beware that
the sizes are machine dependent!
I short 2 bytes signed
I int 4 bytes signed (but 2 bytes on some systems... hargh!i)
I long 8 bytes signed (but is 4 bytes on older systems)
I char 1 byte ASCII code (unlike 2 byte Unicode in Java)
I float 4 bytes IEEE 754 format (same as in Java)
I double 8 bytes IEEE 754 format (same as in Java)
We can use the sizeof operator to determine the size (in bytes) of
any type.
Determining types on a system
/* C-examples/intro/width.c */
#include <stdlib.h>
#include <stdio.h>