C Language Skill UP
  • Twitter
  • Facebook
  • Snapchat
  • Instagram

C Language Operators and Expressions

In this tutorial, you will learn about Operators and Expressions. Operators and expressions are special in C programming that are part of the syntax. Also, you will learn how to use and name them.
Lets first define each of them.
Operators:   Operators are special symbols that are used to perform specific task or operations.
These symbols are known to the compiler.
Expression:   An expression may consist of one or more operands, and zero or more operators to produce a value.
Let learn the operators first.

Operators: There are Broadly eight types of operators in C. They are:

  1. Arithmetic operators
  2. Relational operators
  3. Logical operators
  4. Assignment operators
  5. Bitwise operators
  6. Increment decrement operators(Unary operators)
  7. Special Operators operators
  8. Conditional Operators

1. Arithmetic Operators:
Arithmetic operators are the symbols that perform addition, subtraction, multiplication, division, exponentiation, and modulus operations. Examples.
+     addition operator
-     subtraction operator
*     multiplication operator
/     division operator
%     Modulo.
2. Relational Operators:

Symbol Operation Example Description
< Less Than a < b True if a is Less than b
> Greater than a > b True if a is Greater than b
== Equal a==b True if a is equal b
!= Not equal a!=b True if a is not equal b
<= Less than or equal Greater than or equal True if a is greater than or equal to b
>= Greater than or equal a>=b True if a is greater than or equal to b

3. Logical Operators:
Symbol Operation Example Description
&& Logical AND (x>5) &&(y<5) It returns true when both conditions are True
|| logical OR (x>=10)||(y>=10) It returns when any one of the condition is True
! logical NOT !(x>=5) It returns True when value of x is not greater or equal to 5

4. Assignment Operators:
Symbol Operation Performed
= Assignment
%= Remainder Assignment
+= Addition Assignment
-= Subtraction Assignment
<<= Left-shift Assignment

5. Bitwise Operators:
>>    : Right Shift Operator   e.g a>>b
<<   : Left Shift Operator   e.g a<< b
6. Increment Decrement Operators
++   Increment the value of variable by 1 e.g a=5;
a++;   // increment the value of a by 1 i.e a=a+1
--  Decrement the value of variable by 1 e.g a=5;
a--;   //decement the value of a by 1 i.e a=a-1

7. Special Operators:
   &   :This operator is used to get the address of the variable.
*  : This operator is used as a pointer to a variable.
e.g.*a    where * is a pointer to the variable a.
8. Conditional Operator(?:):
The conditional operator is also called a ternary operator because it requires three operands. This operator is used for decision making. In this operator, first we verify a condition, then we perform one operation out of the two operations based on the condition result. If the condition is TRUE the first option is performed, if the condition is FALSE the second option is performed. The conditional operator is used with the following syntax.
Condition ? TRUE Part : FALSE Part;
in fig. Detail operator Structure.

Operators in C Programming Language.

C Language

  • Home
  • Why C Language
  • History of C Language
  • Applications of C Language
  • Introduction To C
    • What is Program?
    • Structure of C Program
    • Working Of C Program
    • CHARACTER SET
    • VARIABLES AND IDENTIFIERS
    • BUILT-IN DATA TYPES
    • OPERATORS AND EXPRESSIONS
    • CONSTANTS AND LITERALS
    • SIMPLE ASSIGNMENT STATEMENT
    • BASIC INPUT/OUTPUT STATEMENT
    • SIMPLE 'C' PROGRAMS
    • Assignments
  • Operators in C Programming
    • Arithmetic Operators
    • Assignment Operators
    • Increment and Decrement Operators
    • Relational Operators
    • Logical Operators
    • Bitwise Operators
    • Other Operators
    • Assignments
  • CONDITIONAL STATEMENTS
    • DECISION MAKING WITHIN A PROGRAM
    • CONDITIONS
    • IF STATEMENT
    • IF-ELSE STATEMENT
    • IF-ELSE LADDER
    • NESTED IF-ELSE
    • SWITCH CASE
    • Assignments
  • LOOPS STATEMENTS
    • Introduction to Loops
    • GO TO Statement
    • Do while Loop
    • While Loop
    • Nested While Loop
    • Difference Between While and Do while
    • Difference Between Goto and loop
    • while loop assignments
    • C FOR Loop
    • C For loop examples
    • Nested for loop
    • Nested for loop examples
    • Infinite while Loops
    • Infinite for Loops
    • Continue in Loops
    • break in Loops
    • difference while do..while & for
    • Assignments
  • Arrays
    • One Dimensional Array
    • Declaring 1D Arrays
    • Initilization of 1D arrays
    • Accessing element of one 1D Array
    • Read and Display 1D Arrays
    • Two Dimensional Arrays
    • Declare 2D Arrays
    • Read and Display 2D Arrays
    • Assignments/Examples
  • Functions
    • Introduction
    • Need For User-Defined Function
    • Multiple Function Program
    • Modular Programming
    • Elements Of User Defined Function
    • Function Definition
    • Function Declaration
    • Types of functions
    • Nesting of Function
    • Recursion
    • Passing Array To Functions
    • Scope,Visibility and Lifetime of Variables
    • Assignments
  • Structure
    • Introduction
    • Array vs Structure
    • Defining Structure
    • Declaring Structure Variables
    • Type Defined Structure
    • Accessing Structure Members
    • Structure Initilization
    • Copying & Comparing Structure Variables
    • Array of Structure
    • Arrays Within Structure
    • Structures Within Structures
    • Structures and Functions
    • Structure Examples/Assignments
  • Union
    • Define Union
    • Create and use Union
    • Difference Between Structure and Union
    • Union Examples
    • Union FAQ
  • Pointers
    • What Are Pointers In C?
    • How Do We Use Pointers In C?
    • Declaration Of A Pointer
    • The Initialization Of A Pointer
    • Syntax Of Pointer Initialization
    • Use Of Pointers In C
    • The Pointer To An Array
    • The Pointer To A Function
    • The Pointer To A Structure
    • Types Of Pointers
    • The Null Pointer
    • The Void Pointer
    • The Wild Pointer
    • The Near Pointer
    • The Huge Pointer
    • The far Pointer
    • dangling pointer
    • Accessing Pointers- Indirectly And Directly
    • Pros Of Using Pointers In C
    • Cons Of Pointers In C
    • Applications Of Pointers In C
    • The & Address Of Operator In C
    • How To Read The Complex Pointers In C?
    • Practice Problems On Pointers
  • File Processiong
    • File Handling In C
    • Types Of Files In C
    • Operations Done In File Handling
    • File Examples
    • Binary Files
    • count words,lines in a file
    • Copy files
    • Update File
    • count vowels in a file
  • Preprocessor
    • Macro substitution division
    • File Inclusion
    • Conditional Compilation
    • Other directives
    • Examples
  • Dynamic Memory Allocation
    • malloc
    • calloc
    • free
    • realloc
    • Examples
  • Storage Classes
  • Graphics
  • Frequently Asked Interview Questions (FAQ)
    • Introduction To C FAQ
    • Operators FAQ
    • Conditional Statements FAQ
    • Loops FAQ
    • Arrays FAQ
    • Function FAQ
    • Structure FAQ
    • Pointers FAQ
    • Files FAQ
    • Storage classes FAQ
    • Dynamic Memory FAQ
  • Programs/Assignments
    • Introduction To C
    • Operators
    • Conditional Statements
    • Loops
    • Arrays
    • Function
    • Structure
    • Pointers
    • Files
    • Storage classes
    • Dynamic Memory
  • Case Studies
  • Multiple Choice Questions
    • Introduction To C MCQ
    • Operators MCQ
    • Conditional Statements MCQ
    • Loops MCQ
    • Arrays MCQ
    • Function MCQ
    • Structure MCQ
    • Pointers MCQ
    • Files MCQ
    • Storage classes MCQ
    • Dynamic Memory MCQ
    • More MCQ

Get in touch

  • tech2dsm@gmail.com

© Sankalan Data Technologies. All rights reserved.