i am a note

C Programming

January 4, 2021

Operators in C programming language

Operators are symbols that tells the compiler to perform specific functions.

C language provides the following types of operators:-

1. Arithmetic Operators

These operators are used to perform mathematical/arithmetic operations.

+(Addition), (Subtraction), *(Multiplication), /(Division), %(Modul), ++(Increment), (Decrement)

2. Relational Operators

These operators are used to compare values, in condition.

==(Equal to), !=(Not Equal to), >(Greater Than),  <(Smaller Than), >=(Greater Than or Equal to), <=(Smaller Than or Equal to)

3. Logical Operators

These operators are used to combine two or more conditions.

&&(Logical AND), ||(Logical OR), !(Logical NOT)

4. Bitwise Operators

The Bitwise operators are used to perform bit-level calculations. The operators are first converted to bit-level and then the calculation is performed.

&(Binary AND), |(Binary OR), ^(BinaryXOR), ~(Binary One’s Complement), <<(Binary Left Shift), >>(Binary Right Shift)

5. Assignment Operators

These operators are used to assign value to a variable.

=(Simple assignment), +=(Add AND assignment), -=(Subtract AND assignment), *=(Multiply AND assignment), /=(Divide AND assignment), %=(Modulus AND assignment), <<=(Left shift AND assignment), >>(Right shift AND assignment), &=(Bitwise AND assignment), ^=(Bitwise exclusive OR and assignment), |=(Bitwise inclusive OR and assignment)

6. Misc Operators

sizeof()(Returns the size of a variable), &(Returns the address of a variable), *(Pointer to a variable), ?:(Conditional Expression) 

by : Wali Khan

Quick Summary:

Operators are symbols that tells the compiler to perform specific functions. C language provides the following types of operators:- 1. Arithmetic Operators These operators are used to perform mathematical/arithmetic operations. +(Addition), –(Subtraction), *(Multiplication), /(Division), %(Modul), ++(Increment), —(Decrement) 2. Relational Operators These operators are used to compare values, in condition. ==(Equal to), !=(Not Equal to), >(Greater Than),  <(Smaller Than), […]