Professional Documents
Culture Documents
Handbook-C 10
Handbook-C 10
./hello
to run it:
Awesome!
9
Now if you call ls -al hello , you can see that the
program is only 12KB in size:
10
Variables and types
C is a statically typed language.
int age;
11
In this case:
#include <stdio.h>
int main(void) {
int age = 0;
age = 37.2;
printf("%u", age);
}
Integer numbers
C provides us the following types to define integer
values:
char
int
short
long
12
int takes at least 2 bytes. short takes at least 2
bytes. long takes at least 4 bytes.
Unsigned integers
13
For all the above data types, we can prepend
unsigned to start the range at 0, instead of a negative
number. This might make sense in many cases.
#include <stdio.h>
int main(void) {
unsigned char j = 255;
j = j + 10;
printf("%u", j); /* 9 */
}
14