Number data types
Integer Floating point ------------- ------------------ char (1 byte) float (4 bytes) short (2 bytes) double (8 bytes) int (4 bytes) long (8 bytes)
char is like the byte type in Java
I.e.: these are the data types that you used to store an integer (whole) or floating point number
short x = 5; int y; y = x; // Safe to cast short to int
int x = 5; short y; y = x; // Need explicit casting in Java !
#include <stdio.h> int main(int argc, char *argv[]) { int x = 5; short y; y = x; // C allows it !! printf("%d\n", y); }
Try other data types, like casting from double to a short !
We say that: "C is a weakly typed programming language" for the lack of type checking