Data types in C
Fundamental types specifiers in C:
- char; int; float; double; void
- Type qualifiers - specify additional properties(range and precision) of types i) signed ii) unsigned iii) short iv) long
- e.g. signed char (-128 to 127), unsigned char (0 to 255)
- Note: both char and int variables can be use to represent characters, characters are treated as small integers, and conversely, small integers are treated as characters
#include <stdio.h>
void main(void)
{ char c = 'a'; /* 'a' has ASCII encoding 97 */
printf("%c", c + 1); /* b is printed */
printf("%d", c + 2); /* 99 is printed */ }