There are basically three types of instructions in C:
- Type Declaration Instruction
- Arithmetic Instruction
- Control Instruction
The purpose of each of these instructions is given below:
a) Type declaration instruction | To declare the type of variables used in a C program |
b) Arithmetic instruction | To perform arithmetic operations between constants and variables |
c) Control instruction | To control the sequence of execution of various statements in a C program |
Type Declaration Instruction
This instruction is used to declare the type of variables being used in the program. Any variable used in the program must be declared before using it in any statement. The type declaration statement is written at the beginning of main( ) function
Ex.: int bas ;
float rs, grosssal ;
char name, code ;
Arithmetic Instruction
A C arithmetic instruction consists of a variable name on the left hand side of = and variable names & constants on the right hand side of =. The variables and constants appearing on the right hand side of = are connected by arithmetic operators like +, -, *, and /.
Ex.: int ad ;
float kot, deta, alpha, beta, gamma ;
ad = 3200 ;
kot = 0.0056 ;
deta = alpha * beta / gamma + 3.2 * 2 / 5 ;