C - Intricacies of Data Types Flashcards
(8 cards)
What are the four basic arithmetic type specifiers?
char, int, float, and double
What are the four modifiers for type specifiers?
signed, unsigned, short, and long
What is the size of a char?
1 byte (8 bits)
What type is a char?
Characters are integer types. They’re stored as numbers using encoding standards such as ASCII and Unicode.
What is the range of a char / signed char?
Atleast [-127, +127]
What is the range of an unsigned char?
Atleast [0, +255]
How do you declare strings?
You declare the strings the same as an array.
Example (string literal, implicit length): char myString[] = “String”;
Example 2 (string literal, explicit length): char myString[9] = “String”;
Example 3 (implicit length): char myString[] = {‘S’, ‘t’, ‘r’, ‘i’, ‘n’, ‘g’};
Example 4 (explicit length): char myString[9] = {‘S’, ‘t’, ‘r’, ‘i’, ‘n’, ‘g’};