Overview
"Operators are functions that use a symbolic name
  "perform mathematical or logical functions
"Operators
 be
           are predefined in C, just like they are in most other languages, and most operators tend to
      combined withthe infix style
"A logical operator (sometimes called a "Booleanoperator") is an operator that returns a Boolean
 result that's based on the Boolean result of one or two other expressions
"An arithmetic operator is a mathematical function that takes two operands and performs a calculation
 on them
"Other operators include assignment, relational (<, >, !=), bitwise (<<, >>,~)
C FOR BEGINNERS
Overview                                  {lean        DOodemy
Overview
"Lets discuss, arithmetic, logical., assignment and relational operators
"An arithmetic operator is amathematical function that takes two operands and performs a calculation
 on them
"A logical operator (sometimes called a "Boolean operator") is an operator that returns a Boolean
 result that's based on the Boolean result of one or twoother expressions
"Assignment operators set variables equal to values
  "assigns the value of the expression at its right to the variable at its left
"A relational operator willcompare variables against eachother
CFORBEGINNERS
BasicOperators                                 lean       Doodem
Arithmetic Operators in C
 Operator                             Description                                           Example
                 Adds two operands.                                                          A+B= 30
                 Subtracts second operand from the first.                                   A-B=-10
                 Multiplies both operands.                                                 A*B= 200
                 Divides numerator by de-numerator.                                         B/A= 2
     %           Modulus Operator and remainder of after an integer                         B %A=0
                 division.
     ++          Increment operator increases the integer value by one.                     A++ = 11
                 Decrement operator decreases the integer value by                            A-- =9
                 one.
                                                                     ****** Al tables taken from tutorials points website
CFOR BEGINNERS
Basic Operators                                               Leanogomme
                                                                     COodemy
  Logical Operators
   Operator                               Description                              Example
       &&         Called Logical AND operator. If both the operands are        (A&& B) is false.
                  non-zero, then the condition becomes true.
                  Called Logical OR Operator. If any of the two operands        (A|| B) is true.
                  is non-zero, then the condition becomes true.
                  Called Logical NOT Operator. It is used toreverse the        !(A&& B) is true.
                  logical state of its operand. If a condition is true, then
                  Logical NOT operator will make it false.
CFOR BEGINNE RS
Basic Operators                                     {}lean         Coodemy
#include <stdio.h>
int main ()
    int a     = 33;
    int b = 15;
    int result        0;
     printf ("c is %d\n", at+);
   return 0;
c is 33
 7
 8   #include <stdio.h>
 9
10  int main ()
11 ={
12      int a = 33;
13       int   b = 15;
14      int    result    0;
15
16       printf ("c is %d\n", tta) ;
17
18      return 0;
19
20
21
Cis 34
test.c x
            6   */
            7
            8   #include <stdio. h>
            9
            10 int main ()
           11 {
           12      Bool a                true;
           13      Bool b              = true;
           14          Bool result;
           15
           16         result= a          && b;
           17                 I
           18         printf ("%d", result) ;
           19
           20        return       0;
           21
1
Process returned e (
Press any key to cont
   Assignment Operators
   Operator                               Description                                   Example
                  Simple assignment operator                                  C=A+B will assign the value
                                                                          of A + B to C
                  Add ANDassignment operator. It adds the right
                                                                                    equivalent to C= C+
                  operand to the left operand and assign the result to the Ct= A is
                                                                          A
                  left operand.
                  Subtract ANDassignment operator. It subtracts the
                  right operand from the left operand and assigns the     C-=A is equivalentto C= C-A
                  result to the left operand.
                  Multiply AND assignment operator. It multiplies the
                  right operand with the left operand and assigns the     C*=A is equivalent to C= C*
                  result to the left operand.                             A
CFOR BEGINNERS
Basic Operators                                    {}leon       Coodemy
  Assignment Operators (cont'd)
 Operator                             Description                                     Example
                Divide ANDassignment operator. It divides the left
                  operandwith the right operand and assigns the result C/= Ais equivalent to C=C/A
                to the left operand.
    %=          Modulus AND assignment operator. It takes modulus
                                                                            C%= A is equivalent to C= C%
                using two operands and assigns the result to the left
                                                                        A
                operand.
    <<=         Left shift AND assignment operator.                     C<«=2 is same as C = C<«2
                Right shift AND assignment operator.                    C>>=2 is sameas C = C>> 2
    &=          Bitwise AND assignment operator.                        C&=2 is same as C=C&2
                Bitwise exclusive OR and assignment operator.           C^= 2 is same as C= C^2
                Bitwise inclusive OR and assignmentoperator.            C=2 is same as C= C 2
CFORBEGINNERS
Basic Operators
                                                       leanogomm
                                                              Coodemy
   Relational Operators
   Operator                                  Description                                     Example
                  Checks if the values of two operands are equal or not. If yes,       (A == B) is not true.
                  then the condition becomes true.
                  Checks if the values of two operands are equal or not. If the          (A != B) is true.
                  values are not equal, then the condition becomes true.
       V
                  Checks if the value of left operand is greater than the value of    (A> B)is not true.
                  right operand. If yes, then the condition becomes true.
                  Checks if the value of left operand is less than the value of         (A<B) is true.
                  right operand. If yes, then the condition becomes true.
                  Checks if the value of left operand is greater than or equal to    (A >= B) is not true.
                  the value of right operand. If yes, then the condition
                  becomes true.
      <=          Checks if the value of left operand is less than or equal to the     (A <= B) is true.
                  value of right operand. If yes, then the condition becomes
                  true.
CFOR BEGINNERS
Basic Operators                                             {lean           Codemy