Programming languages - Instructions


What does an instruction look like?

The instruction is the key element in the computer as it tells the processor which action should be performed. The instructions which are to be executed are indicated in the source file and the computer goes from one instruction to the next following the instructions from top to bottom (as a file is read in sequence from top to bottom).
An instruction is generally comprised of two elements:

  • the operator: the action that the processor is to carry out
  • the operand(s): one or more pieces of data on which the operation is performed

operator operand(s)

Types of operators:

There are generally two or three types of operators:

  • Unary operators: those which operate on one operand only
  • Binary operators: these operators are those which, contrary to what you would think, do not work on binary operands, but rather work on two operands (binary here means the number of operands that are affected, addition, often denoted as +, is therefore a binary operator)
  • Ternary operators: are operators which allow three operands (for example, conditional operators are ternary operators)
Operators may also be divided into several categories according to the type of operation they perform when executed:
  • arithmetic operators
  • comparison operators
  • logical operators
  • bit operators
  • assignment operators
  • conditional operators
  • sequential operators
  • ...

Operator priority

Each language generally has operator precedence so that the computer knows in which direction to calculate the operators where several operators exist in the same expression

CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.

Latest update on October 16, 2008 at 09:43 AM by Jean-François Pillou.

This document, titled "Programming languages - Instructions," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).