- What are variables?
- holds information that can be changed
- Why use variables?
- programs with information that's predetermined is not very useful
- How to use variables?
- declare variables
- initialize variables
- set, change, or display variables
- What are data type's?
- data types specifies what type of information is stored by the variable
- C has many type's available, they are listed here
- Why use data type's?
- so the program knows how much memory to allocate and how to interpret the allocated memory
- C requires all variables to be type'd
- some programming languages don't require type'ing
- here's an article on dynamic vs static type'ing, you can just read the conclusion
- How to use data type's?
- to declare an integer number:
int i_am_an_integer;
- to declare a character:
char i_am_a_char;
- to declare a decimal number:
float i_am_a_float;
- to declare a decimal number with higher precision:
double i_am_a_double;
#include <stdio.h>
main() {
// declare variables
int i_am_an_integer;
char i_am_a_char;
float i_am_a_float;
double i_am_a_double;
// initialize variables
i_am_an_integer = 11;
i_am_a_char = 'c';
i_am_a_float = 1.23;
i_am_a_double = 1.23;
}