Variables ,constants and Keywords
Variables and constant
variables are the entity whose values can be changed and constants are the entity which can’t be change. while writing programs we might need to perform some mathematical operations on some values or we might need to store some data . To store that values or data we required some part of computers memory. And after allocation of that memory we need to give name to that part of memory so that we can access it in future by using its name. And the values stored in these locations can be changes so these locations are called variable names.
for example:
suppose some value 5 is stored somewhere in memory and we have given name m to that memory. Now in future we can change that value to new value. Let say we changed value from 5 to 7. Now memory denoted by m contains value 7. Since the location whose name is m can hold different values at different times , m is known as variable. and the number 5 or 7 do not change anytime which is called constants.
below is the types of C constants and example of different types of constants
Types of C variable:-
As we already discussed variables in c is the entity whose value is free to change and contain any type of value. Variables are divided into mainly three types depending upon the constant values which variable is going to store. below is the primary types of variables;
1)integer
2)character
3)real
Declaration of variable:-
below is the syntax of declaring a variable
data_type variable_name ;
data_type:- data type denotes the type of variable or we can say which type of value variable is going to be stored.
variable_name:- its a name given to variable by which we can access the memory allocated to us.
example:-
int c; //decalring a integer variable c which will store value of type integer
char c; //decalaring a variable c which will store value of type character
Keywords in C
keywords are the word or name which are already reserved by the developer of c language or we can say whose meaning are already defined by the developer of C. These keywords and their meaning is already known to compiler. We cannot use these keywords or name as our own variables.
there are mainly 32 keywords reserved in c. below is the list of all the keywords available in c. During the series of tutorials of c you will learn manning of almost every keywords.