Data Types
Data types determine the type of data associated with variables. Remember the int keyword we used to create integer variables?
// create an integer variable
int age = 25;Here, int is actually a data type for integer variables. Similarly, there are many other data types in C. For now, we will be looking at the following types:
1. int type - used for integer values without decimal. For example, 4, -43, etc.
2. float type - used for floating-point numbers with decimal. For example, 34.9, 98.2, etc.
3. char type - used for characters. For example, 'g', '(', '-', etc.
Now, to create a variable that stores floating-point numbers and characters, we use the float and char keywords, respectively. For example,
float salary;
char letter;