Tuesday, September 1, 2015

Instruction Type in C


In C programming language 3 types of instructions are available. These are as follows:-

1. Type declaration Instruction      
3. Control Instruction

1. Type Declaration Instruction:-


In C programming language every variable which is used in the program must be declared before its use in any further statements.
So, this instruction is used to declare the type of a variable being used in the program.

For ex.:- If we have to use "a" as a variable typed integer then we should declare it before using it as-
             int a;

Note-1 When we declare any variable at that time we are also eligible to initialize this variable.

For ex.  int i=5,j=7;
             float a=5.5;

Note-2 when we declare and initialize variables together the issue of ordering occurs.
Sometime order of declaration matters and sometime not.

For ex.   1) int i=10,j=25;                
   int j=25,i=10;
             here,order of variable declaration doesn't matter.
          2) float a=1.5,b=a+3.1;
              float b=a+3.1,a=1.5;

No comments:

Post a Comment