Saturday, December 23, 2017

What is operators in c language


Operators are characters 

In the C language, an operator is that symbol – and they are a number of them – that directs the compiler to do specific functions of a mathematical or logical nature. Some of C’s operators are in-built.
      Operators are symbols used to manipulate data in the program. These include the traditional math operators, as well as a host of other special symbols. 

1). Mathematical: +-/*% + +-- 
2). Comparison: = = != > < 
3). Assignment: = + = -+ *= /=
4). Logical: && | | ! 
5). Bitwise: & | ^ < < > >
6). Unary + - ~ ! * 

Types of categories in the operators are explained here:-

  • Arithmetic operators in c language
  • Relational operators in c language 
  • Logical operators in c language
  • Bitwise operators in c language
  • Assignment operators in c language 
  • Conditional operators in c language 
  • Special operators in c language

  • Arithmetic operators 
These are specific and so it is easy to learn and remember them. We shall list them here below and demonstrate how you apply each of them. 
            For our demonstration, we shall assume that variable A has the value of 20, while variable B has the value of 40.

       Arithmetic operators perform arithmetic on numbers (literals or variables).

Operator Description

+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus (Remainder)
++ Increment
-- Decrement

Arithmetic Operations

A typical arithmetic operation operates on two numbers.
The two numbers can be literals:


         var x = 100 + 50 ;

  • Relational operators :-
These ones help you to determine the block to follow, once you compare the values between two variables already in storage.

       using the same two variables, A = 20 and B = 40.

  • Logical operators :-
There are basically three logical operators that the C programming language supports. Assuming that A is one of your variables and its value is 1; and B is the other one of your variables and its value is 0;

  • Bitwise operators :- 
         These operators work by manipulating data right at the bit level. They also shift bits from the right position to the left. Note that bitwise operators do not work with C’s float variables or the double float variables.

  • Assignment operators :- 
 The C language supports a number of assignment operators. Below are the assignment operators that C supports.

  • Conditional operators :-
This operator also goes by the term ternary operator. Conditional operators play the role of evaluating condition.

  • Special operators:-
Each special operator is different from the others, each performing its unique function.
      operator returns the number of bytes that will be used to represent the operand. The operand can be an expression or a type name. 

For example :-

size of(int) will return the number to bytes used by an integer (generally 4). You can also use this operator to get the size of a structure or union. Read more 


Please comment and follow this site blog inbox