Static variables are variables in which the compiler allocates memory for them throughout the entire run of the program. Static variables are placed on the data segment of a programs memory and are usually associated before the program is executed.