Blogs

Operators and Expressions

operator-Any symbol that performs certain operations.e.g.+,-,*,/,%,==,<=,>=.!=.

Operand– Data or variables upon which the operator performs its operations.

Expression-Logical combination of operator and operands that performs a single statement. C=a+b.Where c ,a,bis operand,= and + are operator and whole is known as equation.combination of operators and operands according to the syntax of programming language.

Types of operators:

I)On the basis of operand:

i.Unary operator: It takes single operand.Unary plus(+) ,unary minus(-),increment(++),decrement(–).int a=s,printf(“a=%d”,a),printf(“a=%d”,a++),printf(“a=%d”,a–).

ii.Binary operator: It takes two operands.e.g: addition(+),subtraction(-).multiplication(*),division(/),modular division(%),greater than(>),less than(<),equals to (==) etc.

iii.Tertiary operator: It takes three operande.g:conditional statement(?:),first exp? exp2:exp3 int a,b,c a=6 b=9 c=a<b?b:a;

II)On the basis of function/Operation:

i.Arithmetic operator:+,-,*,%,/

ii.Relational operator:==,<,>,<=,>=,!=.

iii.Logical operator: &&-AND,||-OR,!-NOT.

iv.Assignment operator : =,+=,-=,*=,/=.

v.Increment operator/Decrement operator: ++,–

vi.Conditional operator: ?:

vii.Bitwise operator: &-Bitwise AND,>>-Shift right,<<-Shift left,|-Bitwise OR,^-Bitwise XOR

viii.Special operator: ,-Comma,*-pointer operator,size of -size of operator

Precedence and Associativity :

precedence- priority given to an operator while evaluating an expression.

Associativity- The order of evaluation of operators having the same level of precedence i.e.either left to right or right to left.


Precedence level Operator       Description                                                                                               Associativity


  1.                        ()                 function call                                                                                               left to right.
  2.                        []                 Array element reference                                                                          left to right.

  3. +                  Unary plus                                                                                                  right to left

  4.                        –                   Unary minus                                                                                              ” ” ”
  5.                       ++                increment                                                                                                    ” ” ”
  6.                       —                  decrement                                                                                                   right to left
  7.                       !                    Logical negation                                                                                         ” ” ”
  8.                       *                   Pointer reference                                                                                         ” ” ”
  9.                      &                   address(in direction)                                                                                   ” ” ”
  10.                   size of             size of an object                                                                                              ” ” ”
  11.                    (type)             type cost                                                                                                         ” ” ”

  12. *                     Multiplication                                                                                               left to right

  13.                      /                    Division                                                                                                          ” ” ”
  14.                   %                      Modulus                                                                                                        ” ” ”

  15. +                       Addition                                                                                                     left to right

  16.                     –                      Subtraction                                                                                                 ” ”  ”

  17. <<                   Left shift                                                                                                     left to right

  18.                     >>                    Right shift                                                                                                    ” ” ”

  19. <                       less than                                                                                                     left to right

  20.                     >                       greater than                                                                                              ” “” “”
  21.                    <=                      less than or equals to                                                                             ” ”  ”
  22.                     >=                     greater than or equals to                                                                       ”  ”  ”

  23. =                     equals to                                                                                                       left to right

  24.                      !=                      not equal to                                                                                                left to right

  25. ^                        Bitwise XOR                                                                                              left to right


  26. |                          Bitwise OR                                                                                               left to right


  27. &&                         Logical AND


  28. ||                          Logical OR


  29. ?:                          conditional expression


  30. = %=                      Assignment operators                                                                               left to right

  31.                x= /=                                                                                                                                              ” ” ”
  32.                &= ^=                                                                                                                                             ” ”  ”
  33.                |=  <<=                                                                                                                                            ” ” ”
  34.                >>=                                                                                                                                                 ” ”  ”

  35. ,                               Comma operator                                                                                         left to right

We the teams of programming faster managed to provide an effective information about the codes of different programming languages.Hope you will learn and understand the codes fast and easy. It's absolutely free, expanding and precise. Our main target is to help those new starters and aid them as far as possible to pave their future in the area of programming. Hoping support and recommendations!

Related Posts

Tricks to use Spotify in unsupported countries in PC , in 2018!How it is possible?

Spotify is a Swedish entertainment company founded by Daniel Ek and Martin Lorentzon which precisely specializes in music, podcast, and video streaming service that launched on 7 October 2008. Spotify  is located in Stockholm, Sweden. It provides DRM-protected…

How to successfully register Wondershare Filmora Video Editor in 2023?

Filmora is a video editing software service built for starters who would like to spend less time understanding the basic functionalities of a video editing software and focus…

The salient uses of PHP and it’s prime scopes .

Introduction The full form of PHP is Personal Home Page. It is an HTML-embedded, server-side scripting language designed for web development. The inventor of PHP is   Rasmus Lerdorf  and…

Python, All you need to know about!

About Python! All you need to know! Python is an open source, integrated and powerful high level programming language. It is easy to learn. It was created by…

Why Kotlin is necessary for developing an android app,features?

Introductions: Kotlin is an open source,stabile-typed programming language mainly for the Android and JVM that incorporates object-intended & functional programming attributes.A team of JetBrains programmers based in Saint…

Is HTML crucial to learn and it’s scopes?

Introduction:  The full of HTML is Hyper Text Markup language. HTML is the standard markup language for creating  Web pages and web applications. The inventor of HTML is…

This Post Has One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *