Home » Primary Memory and Operators in C
Education

Primary Memory and Operators in C

Primary memory or storage is the part of the computer that stores data, programmes, etc. Reading and writing data is very quick in the primary memory as the CPU can access it directly. Moreover, it has a faster access time than the secondary memory. It has a lower storage capacity than the secondary memory but more than the cache memory.

Primary memory can be classified into two types:

  • Read Only Memory (ROM)
  • Random Access Memory (RAM)

Read Only Memory or ROM saves the data that does not need to be changed. It contains bootstrap programmes that initialise the operating system and algorithms that the OS requires. The content in ROM cannot be tampered with or modified.

Types of Read Only Memory (ROM) are:

  • MROM (Masked Read Only Memory)
  • PROM (Programmable Read Only Memory)
  • EPROM (Erasable and Programmable Read Only Memory)
  • EEPROM (Electrically Erasable and Programmable Read Only Memory)

Random Access Memory or RAM is hardware that acts as the internal memory of the CPU. It allows the CPU to execute and open programmes. The computer can write and read information from RAM.

Types of Random Access Memory (RAM) are:

  • Static RAM (SRAM)
  • Dynamic RAM (DRAM)

Importance of Primary Memory

Memory is structured to improve system efficiency and reduce access time for any programme. All files and applications are stored in secondary memory, and the CPU cannot access the secondary memory directly. So the operating system loads the process to Primary Memory, which the CPU can directly access by taking less time to execute.

Operators in C

Operators in C are the symbols that are used for performing specific logical or mathematical functions. The operators are the foundations of programming languages, and thus, without operators, it is impossible for the programmers to operate computations, both logical and mathematical operands.

Types of Operators in C are:

  • Relational Operators: Relational operators are used to compare the values of two operands. It is also used to check if one operand is equal to or greater than other operands.
  • Arithmetic Operators: These are responsible for performing arithmetic operations like addition, multiplication, subtraction, division, increment, decrement, and the remainder of the division (%).

There are two types of arithmetic operators:

  • Unary Operators
  • Binary Operators
  • Logical Operators: They are used for True or False results.
  • Assignment Operators:  Assignment operators in c for assigning any value to the given variable.
  • Bitwise Operators: These are used to perform bit-level operations. The operators are converted to bit-level before performing the calculations.
  • Misc Operators: C programming language uses a few other crucial operators that include operators (such as ? : and sizeof). It is used to return the actual size of any given variable.

Uses of Operators in C

Operators are basically used to perform various operations such as logical, relational, arithmetic or many other operations. A programmer must use operators in C to perform mathematical operations. The primary purpose of operators is to perform the above-mentioned operations. In addition to this, C comes with some built-in functions that are rich in nature. The use of these operators is vast. Without these operators, the C language is pretty much useless as these operators act as very powerful and useful features of all the programming languages.

We have provided a few operators in C in the table below:

Type of Operator Associativity Category
() [] -> . ++ – – Left to right Postfix
– + ! ~ – – ++ (type)* & sizeof Right to left The Unary Operator
/ * % Left to right The Multiplicative Operator
To subtract the value of the second operator from the first one. P – Q = 25
To add the value of the second operator with the first one. + P + Q = 75
To divide the value of the numerator with the value of the denominator. / P / Q = 2
To multiply the value of the second operator with the first one. * P * Q = 1250

 

About the author

Asfandkhan77

Add Comment

Click here to post a comment