Variables

Variables are boxes to save some data

Data Types

We have to tell the computer what type of box it is (i.e. how big the box is and what we will put inside it

There are 3 groups of data types:

Variable Declaration

tell the computer the box's name and what we want to put inside

We must tell the computer that we are about to use a variable with some name before we use it. This action is called a declaration. And we can only declare a variable with the same name once per scope, (we'll talk about that later). We can declare one with this syntax: <type> <variable_name>;. For example:

int some_integer; // Declaring some_integer as a integer
char c; //Declaring c as a character
float f; //Declaring f as a 32-bit, single-precision floating point value

Last updated