Variables in C programming are the data storage names that are used to store data values during the program.
We learned that Constants in C remains unchanged during the execution of the program. But variables can have different values during the program execution. The Variables can change values dynamically.
Naming the Variables in C Language
The variable names are chosen by programmers. The recommended way to choose variable names is choosing meaningful names.
For example if we need a variable to store mark of a student, we can name the variable as student_mark or stud_mark etc.
Variable names are identifiers consist of letters, digits, and underscores. The five rules in naming identifiers in C programming should also be followed to name the variables.
- The first character must be an alphabet or underscore.
- Must consist of only letters, digits and underscore.
- Only the first 31 characters of an identifier are significant, others are ignored by the C compiler.
- A keyword cannot be used as an identifier.
- An identifier must not contain white spaces.
Examples for valid variable names: student_mark, mark1, stude_1 etc.
In the upcoming lessons we will learn declaring variables in C language.