Instruction set in C

Instruction is the command formed by the grouping of constants, variables & keywords. It tells the compiler what to do.
There are basically four types of instruction in C.
1. Type Declaration Instruction:-This type of instruction is used to declare the type of variable being used in the program.
Any variable used in the program must be declared before using it in any statement.This instruction is usually written at the beginning of the C program.
e.x.: int i;
char nm,d.
2. Input Output instruction:- These instructions are used to supply input data to a program and obtain the output results from it.
e.x.: printf(), scanf().
3. Arithmetic Instructions:- These types of instructions are used to perform arithmetic operations between constants and variables.Some of the arithmetic operators are: +, -, * and /.
e.x.: int a;
float b,de,al,ga,be;
a=500;
b=0.0056;
d=al*be/ga+0.5*2/5;
There are three types of arithmetic statements:
i.Integer mode arithmetic statement:- In this type of arithmetic statement all operands are either integer variable or integer constant.
ii.Real mode arithmetic statement:- In this type of arithmetic statement all operands are either real constant or real variables.
iii.Mixed mode arithmetic statement:- In this type of arithmetic statement some of the operands are integer and some of them are real.
4. Control Instructions:- These types of instructions are used for controlling the sequence of execution of various statements in C program. It determines the 'flow of control' in a program.There are four types of control instructions in C:
i.Sequence Control Instructions:- The sequence control instruction ensures that the instructions are executed in the same order in which they appear in the program.
ii.Selection or Decision Control Instructions:- These types of instruction allow the computer to take a decision.
iii.Case Control Instruction:- These types of instruction determine which instruction is to be executed next.
iv.Repetition or Loop Control Instruction:- The loop control instruction helps computer to execute a group of statements repeatedly.

Comments

Post a Comment

Popular posts from this blog

Components of C language

Decision making using if statement

How to make payment for final certificate, migration, provisional for the students of last semester of ptu?