Variables are references used to store information for a future use
-
main data types:
- Int
- Float
- Double
- Char
- As a bonus tip right from the start, you can create more than one variable of the same type at a time by listing them with commas between their names, like type variable1, variable_2, variable_3, variable4.
- Names can be composed of upper and lower case letters, numbers, and underscores.
- The first character must be a letter (upper or lower case).
- No keywords are allowed as the full name (int is not allowed but int_count would work).
- In C, you must specify the type of the variable when you declare it. Once it is set, that type of information is the only type that can go into that variable. So if you create a variable of type int, which can only store whole numbers, you will not be able to store "a" nor 1.2 in it. The table below details these types we are going over and what information can go into each.
- printf works like the print function in Python or the console.log() in Javascript
- The basic format is printf("string to display", [list of optional parameters])