c instructions and its types

In the C programming language, there are three main categories of instructions: control instructions, input/output instructions, and computational instructions.

Control instructions

Control instructions are used to control the flow of execution of a program. They allow the program to make decisions based on certain conditions, and to repeat a set of statements a certain number of times. There are three main types of control instructions in C: decision making statements, loop statements, and jump statements.

  • Decision making statements: These statements are used to make decisions based on certain conditions. The two main decision making statements in C are the “if” statement and the “switch” statement.
  • Loop statements: These statements are used to repeat a set of statements a certain number of times. The three main loop statements in C are the “for” loop, the “while” loop, and the “do-while” loop.
  • Jump statements: These statements are used to transfer control of a program to a different part of the program. The three main jump statements in C are the “break” statement, the “continue” statement, and the “goto” statement.

Input/output instructions

Input/output instructions are used to communicate with the outside world. They allow the program to read data from a file or from the user, and to write data to a file or to the screen. Some common input/output instructions in C include “printf”, “scanf”, “fopen”, “fclose”, “fread”, and “fwrite”.

Computational instructions

Computational instructions are used to perform mathematical and logical operations. They allow the program to add, subtract, multiply, divide, and compare values. Some common computational instructions in C include “+”, “-“, “*”, “/”, “>”, “<“, “>=”, “<=”, “==”, and “!=”.

In conclusion, control instructions, input/output instructions, and computational instructions are the three main types of instructions in C. Each type serves a unique purpose in the programming language, allowing the program to control its flow, communicate with the outside world, and perform mathematical and logical operations.