Variable, Constant and Keyword in C
Resource download – List of C keywords PDF (Click here to download)
The above video is an extract from the online course – “C Programming: The ultimate guide for beginners” which we are currently working on. Consider subscribing to Youtube channel – Aptuts in order to get latest updates on new videos and online C programming course.
Variable, constant or keyword in C can be formed from any combination of Alphabets, Digits and Special Symbols. A constant in C programming is an entity whose value does not change throughout the program execution.
A variable in C is an entity whose value keeps on changing throughout the program execution. However, it’s not a rule that the value of the variable will change. A variable in C value might remain same throughout the program execution. However, the main difference between variable and constant in C is that we can’t change the value of constant in between the program, but we can change the value of the variable during program execution.
Let us take an example of constant and variable in C
We define a variable named x in a program, let us say x=3.
After some time during execution, we change the value of x to 6. Now, x = 6.
Here value of x is getting changed. But the value of 3 and 6 will never change. Hence, x is called a variable and 3 is called a constant.
Keywords in C programming are the words whose meaning has already been explained to the C compiler. The keyword cannot be used as the variable name. If we try to do so we are trying to assign new meaning to the keyword. The keywords in C are also known as ‘Reserved words’.
E.g.: for, if, static, while, do, break etc.
This C tutorial is brought you by LearnCOnline.com