We already used variables in the previous chapters' examples. Now, let's understand this concept better.
A variable
is a memory storage location bounded to a symbolic name. This reserved memory area can be filled or left empty. Basically, it is used to store different types of values. We used the variable ledPin
in our previous examples, with the keyword int
.
Something very useful with variables is the fact that we can change their content (the value) at runtime; this is also why they are called variables, compared to constants that also store values, but that cannot be changed while the program is running.
Variables (and constants) are associated with a type. A type, also called data type, defines the possible nature of data. It also offers a nice way to directly reserve a space with a defined size in memory. C has around 10 main types of data that can be extended as we are going to see here.
I'm deliberately only explaining...