Wednesday - March 13, 2024
#C, C++ and C# #Blog #C Program #Computer Science

What is Instructions in C

Instructions in C

Q) What do you mean by instruction in C? What are the different types of instructions? Explain each of them with an example.

Instruction of Instructions in C

  • A statement written in the C program is known as instruction. It can also be defined as the command of a task given to the computer.
control instructions in c, type declaration instruction in c, c instruction set, inputoutput instructions in c, arithmetic instructions in c, online c compiler, data types in c, what the instruction void when written in c program means, how does the instruction end in c?, input/output instructions in c, control instructions in c, hierarchy of operations type conversion, arithmetic instructions in c, what is program, online c compiler, quick revision of c programming pdf, c programming links, c programming useful resources, sample questions of c programming, subjective questions on c programming,

Type of instruction

  • There remain basically three types of instructions in C:
  1. Type declaration instruction
  2. Arithmetic instruction
  3. Control instruction

Type declaration instruction

  • The instruction is used to declare the type of the variable being used in the program. Each variable used in the program must equal declared before using it in any statement.
  • The type declaration statement is written at the beginning of a main() function.

Example:

void main()

{

 int age;

float price = 10.5;

int j = 10, j = 20;

}

Arithmetic instruction

  • Here instruction is done to perform arithmetic operations.
  • The C arithmetic instruction consists of a variable name on the left-hand side of = and an arithmetic expression on the right-hand side of=
  • The variable and constants appearing on the right-hand side of= are connected by arithmetic operators like+,-,* and /.

Example:

c = a * b + 5. 5 / 2;

Control Instruction

  • Because some name suggests the ‘control instructions enable us to specify the order within which the various instructions in each program are to be executed by the computer.
  • In other words, some control instructions determine the specific flow of control in a program. There are four types of control instruction in C.

They are Control Instructions:

  1. Sequence control instruction
  2. Selection of decision control instruction (if-else)
  3. Repetition or loop control instruction  (While, do-while, for)
  4. Case-control instruction  (switch case)

.