3 Variables

Variables are allocated space in memory which contain a value which can be a type of data like text or a number. Variables can be changed and manipulated whilst the program is running as pre set in the algorithms and similar you have written. Below is example code of 3 basic C data types (although theres quite a few more I will go over later on in the next section) the data types in the below code are self explantory to what they equal, but if you don’t understand then int stands for integer, a whole number, a float is a decimal number (you can indicate decimal places like below in printf also) and char is a single character.

#include <stdio.h>

int main() {

    int numberVariable = 205;
    float floatVariable = 101.86;
    char characterVariable = 'a';

    printf("%d\n", numberVariable);
    printf("%.2f\n", floatVariable);
    printf("%c\n", characterVariable);
    return 0;
}