Operators

Operators:

  1. Operators are functions that use symbolic name or symbols.

2. It directs or guides the compiler to perform a mathematical operation or logical manipulation.

3. Operators are predefined in C just like they are done in most of the other languages and most of the operators tend to be combined with infix styles.

C programming language provides us the following operators:

Part 1

1. Arithmetic Operator

2. Logical Operator

3. Relational Operator

4. Bitwise Operator

5. Assignment Operator.

Arithmetic Operator:

Ø In C we will have to perform some calculations which can be easily fulfilled by the arithmetic operators.

Ø An arithmetic operator is used for mathematical function.

Ø It helps us to perform calculations.

Logical Operators:

Ø We sometimes need to logically operate here comes the use of Logical Operators.

Ø This sometimes turns out to be Boolean type of operator.

Ø Because Boolean operator also does the same evaluates the conditions whether to be true or false.

Ø So the last operator makes a specific condition given if false makes it true.

Assignment Operators:

Ø We do need to assign the value of something and make a use of it after wards whenever, required while we code so we need the assignment operators in such a case wherein we can accomplish a specific target assigned by us.

Relational Operator:

Ø It is used to create a relation between two operators and check whether the condition is true of false.

Ø It is kind of a Boolean operator.

Bitwise Operators:

Ø They are some special sets provided by “C,” they are used in bit level programming.

Ø They are used to manipulate bits of an integer expression.

Ø It stores huge sets of data.

Ø With the help of binary number concept, we manipulate the data.

Binary Numbers:

Ø A binary number includes zero’s and one’s.

Ø The number could be of any length.

Ø Example:

Ø 0 1001

Ø 1 1000100

Ø 10 001010101010

Ø 01 0101011101010

Ø 110 0101010101001010

Ø Every binary number has a corresponding decimal value. (vice versa)

Ø Each position for a binary number has a value.

Ø For each digit multiply the digit by its position value.

Ø Add up all the products to get a final answer.

Ø Position value of every binary is power of two.

Ø Example: We have a number 1101001 is 210.

128 64 32 16 8 4 2 1

1 1 0 1 0 0 1 0

o 0X1 = 0

o 1X2 = 2

o 0X4 = 0

o 0X8 = 0

o 1X16 = 16

o 0X32 = 0

o 1X64 = 64

o 1X128 = 128 **CHECK:128+64+16+2 = 210*

Ø TOTAL: 210

Scroll to top