Search This Blog

Translate

What is Constant Variable and Keywords

what is Constant :


In C programming language constant is entity that doesn't change during the execution of program.
examples of constant are 100, 5 ,10 etc.

as we can't say that 5=10 because 5 is fixed value  there are different types of constant are available in c 
which are 
  1.  Integer constant :  It may be +ve or -ve value, it  should not contains decimal point ,in this constant no commas and blank spaces allowed. example 6,100,445 etc.
  2. Real or float constant:  It may be +ve or -ve value, it  should contains decimal point ,in this constant no commas and blank spaces allowed.  
  3. Character constant : it may be single alphabet, single digit , or special symbol enclosed with single code . example '9' , '#', 'A' etc. 
what is Variable:
During programming  in c we perform calculation . To store the result of this calculation we need a variable.
To understand variable you must know how computer memory structure works during execution of program.

computer memory is made up of large number of cells as shown in the diagram ,each cell is used for storage purpose as there are millions of cell each cell may contain some garbage value 

computer use this cell to store value. to access this value again we give certain name to this cell so that it become easy to retrieve this value for our next use.

as i have given x as name to computer memory cell and store value  5  as x=5 as shown in the figure 

 as during calculation value of x can be change.
as shown in the figure  now value of x is 8 as x=8

It means  their is only single cell but depends on time value is going to change as our program execution is going on .

means variable is a entity that changes during the execution of program.

what is Keywords in C ?

As Name itself explain the meaning . key means certain important  words.

it means this words have certain meaning for compiler we cannot use this words as a variable name in our program.

their are 32 keywords in c but the count may vary depends on compiler.

In Short Keywords are Reserved words of compiler








C Program example List

Google+ Badge