Data type
What kind of value is stored: an integer, a number with decimals, a letter or true/false. The processor handles the basic ones directly.
Example
Age 42 is an int, price 3.14 is a float, the letter "A" is a char and "paid?" is a bool.
Test yourself: Data type
Basic data types
What type do you use to store whether a user is online or not?
There are only 2 possible answers, true or false. For 1 million users that's 1 million booleans.
Basic data types
All languages use exactly the same sizes for their basic types.
A char takes 1 byte in C and 2 in Java. A 1,000-letter text takes about 1,000 bytes in one and 2,000 in the other.
Basic data types
In "an array of 10 grades with decimals", what's the data structure?
The array is the row of 10 slots; float is each grade's type, like 7.5. With 10 grades of 4 bytes, the array takes 40 bytes.
0/3
â–¶ Play