🕷️ Crawler Inspector

URL Lookup

Direct Parameter Lookup

Raw Queries and Responses

1. Shard Calculation

Query:
Response:
Calculated Shard: 76 (from laksa112)

2. Crawled Status Check

Query:
Response:

3. Robots.txt Check

Query:
Response:

4. Spam/Ban Check

Query:
Response:

5. Seen Status Check

ℹ️ Skipped - page is already crawled

đź“„
INDEXABLE
âś…
CRAWLED
2 days ago
🤖
ROBOTS ALLOWED

Page Info Filters

FilterStatusConditionDetails
HTTP statusPASSdownload_http_code = 200HTTP 200
Age cutoffPASSdownload_stamp > now() - 6 MONTH0.1 months ago
History dropPASSisNull(history_drop_reason)No drop reason
Spam/banPASSfh_dont_index != 1 AND ml_spam_score = 0ml_spam_score=0
CanonicalPASSmeta_canonical IS NULL OR = '' OR = src_unparsedNot set

Page Details

PropertyValue
URLhttps://www.scholarhat.com/tutorial/c/operators-in-c
Last Crawled2026-04-13 05:13:19 (2 days ago)
First Indexed2023-09-07 09:56:52 (2 years ago)
HTTP Status Code200
Meta TitleOperators in C: Types of Operators
Meta DescriptionOperators in C constitute the building block of the C programming language. They act as potent instruments for data manipulation and control flow. For any C programmer, understanding how these operators function is essential.
Meta Canonicalnull
Boilerpipe Text
Operators in C: An Overview Operators in C constitute the building block of the C Programming Language Online Course Free . They act as potent instruments for data manipulation and control flow. For any C programmer, understanding how these operators function is essential. We'll explain the main operator classifications and their importance in this C Tutorial . To test your theoretical concepts, consider our C Programming Course . What are Operators in C language? Operators are special symbols used to perform various mathematical and logical operations on variables and symbols known as operands . The application of operators varies depending on the context. So, it is important to understand how each type works to use them effectively when programming in C language. Example #include <stdio.h> int a= 10 ; int b= 40 ; int c= a+b; 11 : 16 Here, “+” is an operator that performs the addition of two variables of data type int. The variables a and b are known as the operands. Types of Operators in C C has a wide range of built-in operators that can be classified into various types according to their functionality. Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Assignment Operators Conditional Operator Miscellaneous Operator We can further classify these operators based on the number of operands on which they operate. Now, let us go through all these operators in detail. Read More - Top 50 Mostly Asked C Interview Questions and Answers 1. Arithmetic Operators These operators perform basic mathematical operations like addition, subtraction, multiplication, and division. We will categorize the arithmetic operators in C into two categories based on the number of operands and then look at their functionality. Type Operator Name of Operator Functionality Unary ++ Increment Increases the value by 1 - - Decrement Decreases the value by 1 + Unary plus No change in the operand value - Unary minus changes the negative number to the positive and vice-versa Binary + Addition Add two values - Subtraction Subtracts one value from the other * Multiplication Multiplies two values / Division Divides one by the other value % Modulus Finds the remainder after division Example of Arithmetic Operators in C # include <stdio.h> int main () { //unary operators int x = 5 , y= 6 , z= 7 , w= 8 ; printf ( "%d\n" , ++x); //increments the value of x printf ( "%d\n" , --y); //decrements the value of x printf ( "%d\n" , +z); // unary + printf ( "%d\n" , -w); // unary - on a positive number printf ( "%d\n" ,-(-w)); // unary - on a negative number // binary operators int a = 10 , b = 3 ; int sum = a + b; int difference = a - b; int product = a * b; int quotient = a / b; int remainder = a % b; printf ( "Sum: %d\n" , sum); printf ( "Difference: %d\n" , difference); printf ( "Product: %d\n" , product); printf ( "Quotient: %d\n" , quotient); printf ( "Remainder: %d\n" , remainder); return 0 ; } In the above code in the C Compiler , we have performed all the arithmetic operations on unary as well as binary operands. Output 6 5 7 - 8 8 Sum: 13 Difference: 7 Product: 30 Quotient: 3 Remainder: 1 2. Relational Operators Relational operators in C are also known as Comparison Operators. They compare the values of the two operands. The result of the comparison is either true or false . If the comparison is true, it returns 1; If the comparison results in false, it returns 0. These are known as boolean values. Operator Name == Equal to > Greater than < Less than >= Greater than or equal to <= Less than or equal to != Not equal to Example of Relational Operators in C # include <stdio.h> int main () { int x = 5 ; int y = 3 ; printf ( "%d\n" , x == y); // returns 0 (false) because 5 is not equal to 3 printf ( "%d\n" , x != y); // returns 1 (true) because 5 is not equal to 3 printf ( "%d\n" , x > y); // returns 1 (true) because 5 is greater than 3 printf ( "%d\n" , x < y); // returns 0 (false) because 5 is greater than 3 printf ( "%d\n" , x >= y); // returns 1 (true) because five is greater than, or equal, to 3 printf ( "%d\n" , x <= y); // returns 0 (false) because 5 is neither less than or equal to 3 return 0 ; } The above code performs all the comparison operations and returns the result in boolean values. Output 0 1 1 0 1 0 3. Logical Operators They are used to combine two or more conditions/constraints. It returns either 0 or 1 depending upon whether the expression results in true or false. If the result is true , it returns 1 else returns 0 . The logical operators in C are used in decision-making and looping statements . We will categorize the logical operators into two categories based on the number of operands and then look at their functionality. Type Operator Name Functionality Binary && Logical AND returns 1(true) if both the expressions/values are true. || Logical OR returns 1(true) if one of the expressions/values evaluates to true. Unary != Logical NOT Negates the expression and returns 1 or 0. Example of Logical Operators in C Online Compiler # include <stdio.h> int main () { int a = 1 , b = 0 ; if (a && b) { printf ( "Both a and b are true (non-zero)\n" ); } else { printf ( "At least one of a or b is false (zero)\n" ); } if (a || b) { printf ( "At least one of a or b is true (non-zero)\n" ); } else { printf ( "Both a and b are false (zero)\n" ); } if (!b) //value of b becomes 1 { printf ( "b is false (zero)\n" ); } else { printf ( "b is true (non-zero)\n" ); } return 0 ; } The above code performs all three logical operations on a and b i.e. 1 and 0 respectively. Output At least one of a or b is false (zero) At least one of a or b is true (non-zero) b is false (zero) 4. Bitwise Operators These operators work on individual bits. The operands are first converted into bits i.e. 0 or 1, and then the calculation is performed on them.  We will categorize the bitwise operators into two categories based on the number of operands and then look at their functionality. Type Operator Name Unary ~ One's complement or Bitwise Complement << Left Shift >> Right Shift Binary & Bitwise AND | Bitwise OR ^ Bitwise Exclusive OR or XOR We will look at Bitwise Operators in detail in the section Bitwise Operators in C 5. Assignment Operators These are used to assign values to the variables. The most fundamental assignment operator in C is “=” . Example of Assignment Operators in C #include <stdio.h> int main () { int x; x = 10 ; // Assigning the value 10 to x printf( "The value of x is: %d\n" , x); return 0 ;} In this example, we have assigned the value 10 to the variable x using the assignment operator (=) . Output The value of x is: 10 The following table shows some variants of the assignment operator, “=” . Operator Example Same as = x=y x=y += x+=y x=x+y -= x-=y x=x-y *= x*=y x=x*y /= x/=y x=x/y %= x%=y x=x%y &= x&=y x=x&y |= x|=y x=x|y ^= x^=y x=x^y >>= x>>=y x=x>>y <<= x<<=y x=x<<y 6. Conditional Operator This is also called a ternary operator . It works on three operands. The ternary operator is used to execute a set of statements when the test expression is true and another set of statements when the test expression evaluates to false. Syntax testexpression? expression1 : expression 2 ; Here, the testexpression results in a boolean value i.e. 0(true) or 1(false). If the testexpression evaluates to: True: expression1 before the colon (:) executes False: expression2 after the colon (:) executes Example of Conditional Operator in C # include <stdio.h> int main () { int a = 5 ; int b = 10 ; int max = (a > b) ? a : b; printf ( "The maximum value is: %d\n" , max); return 0 ; } Output The maximum value is: 10 We will look at ternary operators in detail in the section Ternary Operator in C . 7. Miscellaneous Operator Commas are used to divide expressions in a statement and are a part of C's miscellaneous operator (,) . The value of the rightmost expression is returned after evaluating each expression in order from left to right. Example # include <stdio.h> int main() { int a = 5 , b = 10 , c; c = (a++, b++, a + b); printf ( "c = %d\n" , c); return 0 ;} In this example in the C Editor , we have shown how to combine several operations into a single statement using the comma operator. Then, it calculates the sum of a and b and assigns it to c after increasing a and b with the notations a++ and b++ , respectively. Output c = 15 Precedence of Operators in C Operator precedence and associativity help us to determine which operators will be given priority when there are multiple operators in the expression. It is the grouping of terms in an expression and decides how an expression should be evaluated. Category Operator Associativity Postfix () [] ->. ++ - - Left to right Unary + - ! ~ ++ - - (type)* & sizeof Right to left Multiplicative * / % Left to right Additive + - Left to right Shift << >> Left to right Relational < <= > >= Left to right Equality == != Left to right Bitwise AND & Left to right Bitwise XOR ^ Left to right Bitwise OR | Left to right Logical AND && Left to right Logical OR || Left to right Conditional ?: Right to left Assignment = += -= *= /= %=>>= <<= &= ^= |= Right to left Comma , Left to right Summary C language's fundamental building block is its operators, which enable a wide range of operations. The basic kinds of operators in C, including arithmetic, relational, logical, bitwise, and assignment operators, have been outlined in this article along with examples from real-world applications for each. For easy reference, we've included a reference table to help you quickly understand operator precedence, which is essential for writing effective and error-free code. For more information, please consider our C Certification Course . FAQs The four categories of operators in C are the arithmetic, relational, logical, and assignment operators. In C, the "&=" operator is a compound assignment operator used to conduct a bitwise AND operation between two values and assign the result to the left operand. In C, operators are used to manipulate and control data by performing various operations on it, such as calculations, comparisons, logical operations, and assignments. The order in which operators are evaluated in expressions in C is determined by their operator precedence. It helps prevent confusion and make sure that expressions are accurately evaluated while adhering to mathematical norms. With arithmetic operations adhering to conventional mathematical norms and logical and relational operations producing true (1) or false (0) outputs, operations in C are carried out based on operator precedence and associativity.
Markdown
[![Logo](https://www.scholarhat.com/dist/user/assets/logo-CEy3TSwt.png)ScholarHat](https://www.scholarhat.com/) [Live Training]() [All Live Trainings](https://www.scholarhat.com/training) ### Training Categories ![.NET Platform](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/netplatform-mobile.png) .NET Platform ![AI/ML & Gen AI](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aimlgenai-mobile.png) AI/ML & Gen AI ![Career & Leadership](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/careerleadership-mobile.png) Career & Leadership ![Cloud & DevOps](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/clouddevops-mobile.png) Cloud & DevOps ![Java Platform](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/javaplatform-mobile.png) Java Platform ![JS & Front-end](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/jsfrontend-mobile.png) JS & Front-end ### Category Name Live sessions with industry experts [![.NET AI & ML Engineer Certification Training](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aimlcertificationtrainingfornetdevelopers-mobile.png) .NET AI & ML Engineer Certification Training Build Intelligent AI/ML-Driven Solutions with ML.NET](https://www.scholarhat.com/training/net-ai-ml-certification-training) [![.NET Certification Training](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/netcertificationtraining-mobile.png) .NET Certification Training Master C\# & SQL Server from basic to advanced](https://www.scholarhat.com/training/net-certification-training) [![.NET Microservices Certification Training](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/netmicroservicescertificationtraining-mobile.png) .NET Microservices Certification Training Build scalable microservices using .NET & Docker/K8s](https://www.scholarhat.com/training/net-microservices-certification-training) [![.NET Software Architecture and Design Training](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/netsoftwarearchitectureanddesigntraining-mobile.png) .NET Software Architecture and Design Training Design clean, maintainable, enterprise-grade architectures](https://www.scholarhat.com/training/software-architecture-design-training) [![ASP.NET Core Certification Training](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aspnetcorecertificationtraining-mobile.png) ASP.NET Core Certification Training Build fast web apps using ASP.NET Core, EF & Web API](https://www.scholarhat.com/training/aspnet-core-certification-training) [![Blazor Certification Training](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/blazorserver-mobile.png) Blazor Certification Training Build interactive web apps using C\# & Razor](https://www.scholarhat.com/training/blazor-certification-training) #### Join Live Sessions Learn with experts in real-time [Join Now](https://www.scholarhat.com/training/batches) [Job-Ready Tracks]() [All Job-Ready Tracks](https://www.scholarhat.com/job-oriented) ### Training Categories ![.NET](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/net-mobile.png) .NET ![AI/ML](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aiml-mobile.png) AI/ML ![Java](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/java-mobile.png) Java ### .NET Roles-based Live training programs [![.NET & Azure Solution Architect Program](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/microsoftazurecloudarchitect-mobile.png) .NET & Azure Solution Architect Program Master Azure, System Design & Microservices Architecture](https://www.scholarhat.com/job-oriented/net-azure-solution-architect-certification-training) [![AI-Driven .NET Tech Lead Program](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aidrivenazurefullstacknettechleadcertificationprogram-mobile.png) AI-Driven .NET Tech Lead Program Master ASP.NET Core, Angular/React, AI/ML with Azure](https://www.scholarhat.com/job-oriented/net-tech-lead-certification-training) [![AI-Powered Full-Stack .NET Developer Program](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/fullstacknetdevelopercertificationtrainingcourse-mobile.png) AI-Powered Full-Stack .NET Developer Program Master AI, ASP.NET Core with Angular or React](https://www.scholarhat.com/job-oriented/full-stack-net-developer-certification-training) #### Start Your Career Job-ready tracks [Explore](https://www.scholarhat.com/training/batches) [LIVE Batches](https://www.scholarhat.com/training/batches) [FREE Masterclasses](https://www.scholarhat.com/master-classes) [FREE Courses/Books]() [Free Courses](https://www.scholarhat.com/free-course) [Free Books](https://www.scholarhat.com/books) [Skill Tests](https://www.scholarhat.com/skill-tests) [Sandboxes]() [Cloud Sandboxes](https://www.scholarhat.com/sandbox) [Practice DSA](https://www.scholarhat.com/problems) [Explore]() [Membership](https://www.scholarhat.com/membership/live) [Online Compiler](https://www.scholarhat.com/compiler) [Skill Tests](https://www.scholarhat.com/skill-tests) [Tutorial](https://www.scholarhat.com/tutorial) [Reviews](https://www.scholarhat.com/reviews) [0](https://www.scholarhat.com/cart) [Login/SignUp](https://www.scholarhat.com/login) Live Training ![.NET Platform](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/netplatform-mobile.png) .NET Platform ![AI/ML & Gen AI](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aimlgenai-mobile.png) AI/ML & Gen AI ![Career & Leadership](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/careerleadership-mobile.png) Career & Leadership ![Cloud & DevOps](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/clouddevops-mobile.png) Cloud & DevOps ![Java Platform](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/javaplatform-mobile.png) Java Platform ![JS & Front-end](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/jsfrontend-mobile.png) JS & Front-end [All Live Trainings](https://www.scholarhat.com/training) Job Ready Tracks ![.NET](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/net-mobile.png) .NET ![AI/ML](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aiml-mobile.png) AI/ML ![Java](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/java-mobile.png) Java [All Job-Ready Tracks](https://www.scholarhat.com/job-oriented) [Free Master Classes](https://www.scholarhat.com/master-classes) Free Courses / Books [Free Courses](https://www.scholarhat.com/free-course) [Free Books](https://www.scholarhat.com/books) [Skill Assessments](https://www.scholarhat.com/skill-tests) Sandboxes [Cloud Sandboxes](https://www.scholarhat.com/sandbox) [Practice DSA](https://www.scholarhat.com/problems) [Training Batches](https://www.scholarhat.com/training/batches) Explore [Membership](https://www.scholarhat.com/membership/live) [DSA Problems](https://www.scholarhat.com/problems) [Online Compiler](https://www.scholarhat.com/compiler) [Skill Assessments](https://www.scholarhat.com/skill-tests) [Reviews](https://www.scholarhat.com/Reviews) [Tutorials](https://www.scholarhat.com/tutorial) [Login/SignUp](https://www.scholarhat.com/login) [Live Batches](https://www.scholarhat.com/training/batches) [Masterclasses](https://www.scholarhat.com/master-classes) Menu [Free Courses](https://www.scholarhat.com/free-course) Account [Login / Sign Up](https://www.scholarhat.com/Account/Login) Toggle Theme Browse Tutorials ## [Introduction]() [Identifiers in C: Types of Identifiers Beginners 8 min](https://www.scholarhat.com/tutorial/c/identifiers-in-c "Get More Details") [10 Reasons Why You Should Learn C Beginners 5 min](https://www.scholarhat.com/tutorial/c/10-reasons-why-you-should-learn-c "Get More Details") ## [C Basics]() [If Statements in C: Syntax, Examples, and Best Practices Beginners 14 min](https://www.scholarhat.com/tutorial/c/if-statement-in-c "Get More Details") [If...else statement in C Programming Beginners 4 min](https://www.scholarhat.com/tutorial/c/if-else-statement-in-c "Get More Details") [Understanding realloc() function in C Beginners 12 min](https://www.scholarhat.com/tutorial/c/realloc-function-in-c "Get More Details") [if else if statements in C Programming Beginners 8 min](https://www.scholarhat.com/tutorial/c/if-else-if-statements-in-c "Get More Details") [Why C is called middle level language? Beginners 2 min](https://www.scholarhat.com/tutorial/c/why-c-is-called-middle-level-language "Get More Details") [Beginner's Guide to C Programming Beginners 4 min](https://www.scholarhat.com/tutorial/c/c-programming-language-for-beginners "Get More Details") [First C program and Its Syntax Beginners 5 min](https://www.scholarhat.com/tutorial/c/first-C-program-and-syntax-of-C "Get More Details") [Escape Sequences and Comments in C Beginners 10 min](https://www.scholarhat.com/tutorial/c/lines-and-comments-in-C "Get More Details") [Keywords in C: List of Keywords Beginners 17 min](https://www.scholarhat.com/tutorial/c/keywords-in-c "Get More Details") [Top 50 Mostly Asked C Interview Questions and Answers Career 64 min](https://www.scholarhat.com/tutorial/c/c-interview-questions-and-answers "Get More Details") ## [Basics]() [Boolean and Static in C Programming With Examples ( Full Guide ) Beginners 14 min](https://www.scholarhat.com/tutorial/c/boolean-and-static-in-c "Get More Details") ## [Data Structures Basics]() [Learn Data Structures in C With Types Intermediate 41 min](https://www.scholarhat.com/tutorial/c/data-structures-in-c "Get More Details") ## [Constants]() [Constants in C language Intermediate 5 min](https://www.scholarhat.com/tutorial/c/constant-in-c-language "Get More Details") ## [Data Types]() [Data Types in C Programming - A Beginner Guide with examples Beginners 33 min](https://www.scholarhat.com/tutorial/c/data-types-in-c-with-example "Get More Details") ## [Variables]() [Variables in C Programming - Types of Variables in C ( With Examples ) Beginners 18 min](https://www.scholarhat.com/tutorial/c/variables-in-c-language "Get More Details") ## [Expressions]() [Expressions in C Programming - Types of Expressions in C ( With Examples ) Beginners 12 min](https://www.scholarhat.com/tutorial/c/expression-in-c-language "Get More Details") ## [Operators]() [C Programming Assignment Operators Beginners 11 min](https://www.scholarhat.com/tutorial/c/assignment-operator-in-c "Get More Details") [Arithmetic Operators in C Programming Beginners 13 min](https://www.scholarhat.com/tutorial/c/arithmetic-operators-in-c "Get More Details") [Relational Operators in C Programming Beginners 18 min](https://www.scholarhat.com/tutorial/c/relational-operators-in-c "Get More Details") [Logical Operators in C Programming Beginners 11 min](https://www.scholarhat.com/tutorial/c/c-logical-operators "Get More Details") [Operators in C: Types of Operators Beginners 22 min](https://www.scholarhat.com/tutorial/c/operators-in-c "Get More Details") [Bitwise Operators in C: AND, OR, XOR, Shift & Complement Beginners 14 min](https://www.scholarhat.com/tutorial/c/bitwise-operator-in-c "Get More Details") [Ternary Operator in C: Ternary Operator vs. if...else Statement Beginners 5 min](https://www.scholarhat.com/tutorial/c/ternary-operator-in-C "Get More Details") ## [Statements]() [Jump Statements in C: break, continue, goto, return Beginners 13 min](https://www.scholarhat.com/tutorial/c/jump-statements-in-c "Get More Details") [Continue Statement in C: What is Break & Continue Statement in C with Example Beginners 16 min](https://www.scholarhat.com/tutorial/c/break-continue-statement-in-c "Get More Details") ## [Conditional Statements]() [Conditional Statements in C: if, if..else, Nested if Beginners 24 min](https://www.scholarhat.com/tutorial/c/if-else-statements-in-c "Get More Details") [Switch Statement in C: Syntax and Examples Beginners 11 min](https://www.scholarhat.com/tutorial/c/switch-statement-in-c "Get More Details") ## [Loops]() [Understanding do...while loop in C Beginners 5 min](https://www.scholarhat.com/tutorial/c/do-while-loop-in-c "Get More Details") [Understanding for loop in C Beginners 10 min](https://www.scholarhat.com/tutorial/c/for-loop-in-c "Get More Details") [Understanding While loop in C Beginners 8 min](https://www.scholarhat.com/tutorial/c/while-loop-in-c "Get More Details") [Loop in C with Examples: For, While, Do..While Loops Beginners 12 min](https://www.scholarhat.com/tutorial/c/loops-in-c "Get More Details") [Nested Loops in C - Types of Expressions in C ( With Examples ) Beginners 15 min](https://www.scholarhat.com/tutorial/c/nested-loops-in-c "Get More Details") [Infinite Loops in C: Types of Infinite Loops Beginners 8 min](https://www.scholarhat.com/tutorial/c/infinite-loops-in-c "Get More Details") ## [Functions]() [Functions in C: Learn Types of Functions in C Intermediate 13 min](https://www.scholarhat.com/tutorial/c/function-in-c "Get More Details") ## [Recursion]() [Recursion in C: Types, its Working and Examples Intermediate 22 min](https://www.scholarhat.com/tutorial/c/recursion-in-c "Get More Details") ## [Storage Classes]() [Storage Classes in C: Auto, Extern, Static, Register Intermediate 12 min](https://www.scholarhat.com/tutorial/c/storage-class-in-c "Get More Details") ## [Array]() [Arrays in C Programming: Operations on Arrays Intermediate 17 min](https://www.scholarhat.com/tutorial/c/array-in-c "Get More Details") [Multidimensional Arrays in C: 2D and 3D Arrays Advanced 29 min](https://www.scholarhat.com/tutorial/c/multidimensional-arrays-in-c "Get More Details") ## [String]() [Strings in C with Examples: String Functions Intermediate 22 min](https://www.scholarhat.com/tutorial/c/strings-in-c "Get More Details") ## [Pointer]() [Call by Value and Call by Reference in C Intermediate 10 min](https://www.scholarhat.com/tutorial/c/call-by-value-and-call-by-reference-in-c "Get More Details") [Pointers in C: Types of Pointers Advanced 28 min](https://www.scholarhat.com/tutorial/c/pointers-in-c-programming "Get More Details") ## [Memory Allocation]() [How to Dynamically Allocate Memory using calloc() in C? Advanced 14 min](https://www.scholarhat.com/tutorial/c/calloc-function-in-c "Get More Details") [How to Dynamically Allocate Memory using malloc() in C? Advanced 7 min](https://www.scholarhat.com/tutorial/c/malloc-function-in-c "Get More Details") [Dynamic Memory Allocation in C: Malloc(), Calloc(), Realloc(), Free() Advanced 13 min](https://www.scholarhat.com/tutorial/c/dynamic-memory-allocation-in-c-programming "Get More Details") ## [Comparisons]() [Difference Between Structure and Union in C Language Intermediate 7 min](https://www.scholarhat.com/tutorial/c/difference-between-structure-and-union-in-c "Get More Details") ## [Interview]() [C Programming MCQ – C Language Multiple Choice Questions with Answers Questions 71 min](https://www.scholarhat.com/tutorial/c/c-programs-mcq "Get More Details") 1. [Home](https://www.scholarhat.com/) 2. [Tutorials](https://www.scholarhat.com/tutorial) 3. [C](https://www.scholarhat.com/tutorial/c) 4. Operators In C: Types Of .. ![Operators in C: Types of Operators](https://dotnettrickscloud.blob.core.windows.net/article/5620250731224251.webp) # Operators in C: Types of Operators 31 Jul 2025 Beginner 53\.8K Views 22 min read ![](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/cprogrammingcourse-mobile.png) Learn with an interactive course and practical hands-on labs ### Free C Language Course with Certificate [![](https://www.scholarhat.com/images/icons/freecourse.svg) Start Learning Free](https://www.scholarhat.com/free-course/c-course-for-beginners?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Free_Course&utm_content=https://www.scholarhat.com/tutorial/c/operators-in-c) [![](https://www.scholarhat.com/images/icons/freecourse.svg) Free Interview books](https://www.scholarhat.com/books/c-programming-interview-questions-and-answers-book-pdf) [![](https://www.scholarhat.com/images/icons/test.svg) Skill Test]() ## Operators in C: An Overview Operators in C constitute the building block of the **[C Programming Language Online Course Free](https://www.scholarhat.com/free-course/c-course-for-beginners)**. They act as potent instruments for data manipulation and control flow. For any C programmer, understanding how these operators function is essential. We'll explain the main operator classifications and their importance in this [**C Tutorial**](https://www.scholarhat.com/tutorial/c). To test your theoretical concepts, consider our [**C Programming Course**](https://www.scholarhat.com/course/c-programming-course). ## What are Operators in C language? Operators are special symbols used to perform various mathematical and logical operations on variables and symbols known as `operands`. The application of operators varies depending on the context. So, it is important to understand how each type works to use them effectively when programming in C language. #### Example ``` ``` Here, `“+”` is an operator that performs the addition of two variables of [**data type**](https://www.scholarhat.com/tutorial/c/data-types-in-c-with-example) int. The variables `a` and `b` are known as the operands. ## Types of Operators in C C has a wide range of built-in operators that can be classified into various types according to their functionality. 1. Arithmetic Operators 2. Relational Operators 3. Logical Operators 4. Bitwise Operators 5. Assignment Operators 6. Conditional Operator 7. Miscellaneous Operator ![Operator in C](https://dotnettrickscloud.blob.core.windows.net/article/c/5620250731224228.webp) We can further classify these operators based on the number of operands on which they operate. Now, let us go through all these operators in detail. **Read More - [Top 50 Mostly Asked C Interview Questions and Answers](https://www.scholarhat.com/tutorial/c/c-interview-questions-and-answers)** ### 1\. Arithmetic Operators These operators perform basic mathematical operations like addition, subtraction, multiplication, and division. We will categorize the [arithmetic operators in C](https://www.scholarhat.com/tutorial/c/arithmetic-operators-in-c) into two categories based on the number of operands and then look at their functionality. | | | | | |---|---|---|---| | **Type** | **Operator** | **Name of Operator** | **Functionality** | | Unary | \++ | Increment | Increases the value by 1 | | | \- - | Decrement | Decreases the value by 1 | | | \+ | Unary plus | No change in the operand value | | | \- | Unary minus | changes the negative number to the positive and vice-versa | | Binary | \+ | Addition | Add two values | | | \- | Subtraction | Subtracts one value from the other | | | \* | Multiplication | Multiplies two values | | | / | Division | Divides one by the other value | | | % | Modulus | Finds the remainder after division | Example of Arithmetic Operators in C ``` ``` Run Code \>\> In the above code in the [**C Compiler**](https://www.scholarhat.com/compiler/c), we have performed all the arithmetic operations on unary as well as binary operands. #### Output ``` ``` ### 2\. Relational Operators [Relational operators in C](https://www.scholarhat.com/tutorial/c/relational-operators-in-c) are also known as Comparison Operators. They compare the values of the two operands. The result of the comparison is either `true` or `false`. If the comparison is true, it returns 1; If the comparison results in false, it returns 0. These are known as [boolean](https://www.scholarhat.com/tutorial/c/boolean-and-static-in-c) values. | | | |---|---| | **Operator** | **Name** | | \== | Equal to | | \> | Greater than | | \< | Less than | | \>= | Greater than or equal to | | \<= | Less than or equal to | | != | Not equal to | #### Example of Relational Operators in C ``` ``` Run Code \>\> The above code performs all the comparison operations and returns the result in boolean values. #### Output ``` ``` ### 3\. Logical Operators They are used to combine two or more conditions/constraints. It returns either 0 or 1 depending upon whether the expression results in true or false. If the result is `true`, it returns `1` else returns `0`. The [logical operators in C](https://www.scholarhat.com/tutorial/c/c-logical-operators) are used in [decision-making](https://www.scholarhat.com/tutorial/c/if-else-statements-in-c) and [looping statements](https://www.scholarhat.com/tutorial/c/loops-in-c). We will categorize the logical operators into two categories based on the number of operands and then look at their functionality. | | | | | |---|---|---|---| | **Type** | **Operator** | **Name** | **Functionality** | | Binary | && | Logical AND | returns 1(true) if both the expressions/values are true. | | | \|\| | Logical OR | returns 1(true) if one of the expressions/values evaluates to true. | | Unary | != | Logical NOT | Negates the expression and returns 1 or 0. | #### Example of Logical Operators in [C Online Compiler](https://www.scholarhat.com/compiler/c) ``` ``` Run Code \>\> The above code performs all three logical operations on `a` and `b` i.e. 1 and 0 respectively. #### Output ``` At least one of a or b is false (zero) At least one of a or b is true (non-zero) b is false (zero) ``` ### 4\. Bitwise Operators These operators work on individual bits. The operands are first converted into bits i.e. 0 or 1, and then the calculation is performed on them. We will categorize the bitwise operators into two categories based on the number of operands and then look at their functionality. | | | | |---|---|---| | **Type** | **Operator** | **Name** | | Unary | ~ | One's complement or Bitwise Complement | | | \<\< | Left Shift | | | \>\> | Right Shift | | Binary | & | Bitwise AND | | | \| | Bitwise OR | | | ^ | Bitwise Exclusive OR or XOR | We will look at Bitwise Operators in detail in the section [Bitwise Operators in C](https://www.scholarhat.com/tutorial/c/bitwise-operator-in-c) ### 5\. Assignment Operators These are used to assign values to the variables. The most fundamental [assignment operator in C](https://www.scholarhat.com/tutorial/c/assignment-operator-in-c) is `“=”`. #### Example of Assignment Operators in C ``` ``` In this example, we have assigned the value 10 to the variable `x` using the assignment operator **(=)**. #### Output ``` The value of x is: 10 ``` The following table shows some variants of the assignment operator, `“=”`. | | | | |---|---|---| | **Operator** | **Example** | **Same as** | | \= | x=y | x=y | | \+= | x+=y | x=x+y | | \-= | x-=y | x=x-y | | \*= | x\*=y | x=x\*y | | /= | x/=y | x=x/y | | %= | x%=y | x=x%y | | &= | x&=y | x=x\&y | | \|= | x\|=y | x=x\|y | | ^= | x^=y | x=x^y | | \>\>= | x\>\>=y | x=x\>\>y | | \<\<= | x\<\<=y | x=x\<\<y | ### 6\. Conditional Operator This is also called a `ternary operator`. It works on three operands. The ternary operator is used to execute a set of statements when the test expression is true and another set of statements when the test expression evaluates to false. #### Syntax ``` ``` Here, the testexpression results in a boolean value i.e. 0(true) or 1(false). **If the testexpression evaluates to:** - ****True:**** expression1 before the colon`(:)`executes - **False:** expression2 after the colon`(:)` executes #### Example of Conditional Operator in C ``` ``` Run Code \>\> #### Output ``` The maximum value is: 10 ``` **We will look at ternary operators in detail in the section [Ternary Operator in C](https://www.scholarhat.com/tutorial/c/ternary-operator-in-C).** ### 7\. Miscellaneous Operator Commas are used to divide expressions in a statement and are a part of C's miscellaneous operator `(,)`. The value of the rightmost expression is returned after evaluating each expression in order from left to right. #### Example ``` ``` Run Code \>\> In this example in the [**C Editor**](https://www.scholarhat.com/compiler/c), we have shown how to combine several operations into a single statement using the comma operator. Then, it calculates the sum of `a` and `b` and assigns it to `c` after increasing a and b with the notations `a++` and `b++`, respectively. #### Output ``` c = 15 ``` ## Precedence of Operators in C Operator precedence and associativity help us to determine which operators will be given priority when there are multiple operators in the expression. It is the grouping of terms in an expression and decides how an expression should be evaluated. | | | | |---|---|---| | **Category** | **Operator** | **Associativity** | | Postfix | () \[\] -\>. ++ - - | Left to right | | Unary | \+ - ! ~ ++ - - (type)\* & sizeof | Right to left | | Multiplicative | \* / % | Left to right | | Additive | \+ - | Left to right | | Shift | \<\< \>\> | Left to right | | Relational | \< \<= \> \>= | Left to right | | Equality | \== != | Left to right | | Bitwise AND | & | Left to right | | Bitwise XOR | ^ | Left to right | | Bitwise OR | \| | Left to right | | Logical AND | && | Left to right | | Logical OR | \|\| | Left to right | | Conditional | ?: | Right to left | | Assignment | \= += -= \*= /= %=\>\>= \<\<= &= ^= \|= | Right to left | | Comma | , | Left to right | ##### Summary C language's fundamental building block is its operators, which enable a wide range of operations. The basic kinds of operators in C, including arithmetic, relational, logical, bitwise, and assignment operators, have been outlined in this article along with examples from real-world applications for each. For easy reference, we've included a reference table to help you quickly understand operator precedence, which is essential for writing effective and error-free code. For more information, please consider our [**C Certification Course**](https://www.scholarhat.com/course/c-programming-course). ### FAQs ### Q1. What are the four types of operators in C? The four categories of operators in C are the arithmetic, relational, logical, and assignment operators. ### Q2. What is the &= operator in C? In C, the "&=" operator is a compound assignment operator used to conduct a bitwise AND operation between two values and assign the result to the left operand. ### Q3. What is the purpose of operators in C? In C, operators are used to manipulate and control data by performing various operations on it, such as calculations, comparisons, logical operations, and assignments. ### Q4. What is the need for operator precedence in C? The order in which operators are evaluated in expressions in C is determined by their operator precedence. It helps prevent confusion and make sure that expressions are accurately evaluated while adhering to mathematical norms. ### Q5. What are the rules of operations in C? With arithmetic operations adhering to conventional mathematical norms and logical and relational operations producing true (1) or false (0) outputs, operations in C are carried out based on operator precedence and associativity. **Share Article** Similar Articles - [**Arithmetic Operators in C Programming**](https://www.scholarhat.com/tutorial/c/arithmetic-operators-in-c) - [**Loop in C with Examples: For, While, Do..While Loops**](https://www.scholarhat.com/tutorial/c/loops-in-c) - [**if else if statements in C Programming**](https://www.scholarhat.com/tutorial/c/if-else-if-statements-in-c) - [**C Programming MCQ – C Language Multiple Choice Questions with Answers**](https://www.scholarhat.com/tutorial/c/c-programs-mcq) - [**Why C is called middle level language?**](https://www.scholarhat.com/tutorial/c/why-c-is-called-middle-level-language) - [**Multidimensional Arrays in C: 2D and 3D Arrays**](https://www.scholarhat.com/tutorial/c/multidimensional-arrays-in-c) [**![](https://www.scholarhat.com/images/icons/previous.svg) Previous Tutorial**Boolean and Static in C Programming With Examples ( Full Guide )](https://www.scholarhat.com/tutorial/c/boolean-and-static-in-c) [**Next Tutorial ![](https://www.scholarhat.com/images/icons/next.svg)**Bitwise Operators in C: AND, OR, XOR, Shift & Complement](https://www.scholarhat.com/tutorial/c/bitwise-operator-in-c) ###### About Author ![Author image](https://dotnettrickscloud.blob.core.windows.net/uploads/mentorImages/2820240301224200.png) [View Profile](https://www.scholarhat.com/mentors/sakshi-dhameja) Sakshi Dhameja (Author and Mentor) *** She is passionate about different technologies like JavaScript, React, HTML, CSS, Node.js etc. and likes to share knowledge with the developer community. She holds strong learning skills in keeping herself updated with the changing technologies in her area as well as other technologies like Core Java, Python and Cloud. Our Courses [![Data Structures & Algorithms Course For Beginners]() Data Structures & Algorithms Course For Beginners Free Free DSA Online Course with Certification, Dsa Course Free, Free Dsa Course With Certificate, Free Dsa Course View More](https://www.scholarhat.com/free-course/data-structures-algorithms-course?utm_source=training_programs&utm_medium=text&utm_campaign=https://www.scholarhat.com/tutorial/c/operators-in-c "Data Structures & Algorithms Course For Beginners") [![C Programming Course For Beginners]() C Programming Course For Beginners Free Enroll in our free C Programming online course and earn a certificate in just 21 days! Master fundamentals like variables, loops, functions, and pointers with hands-on exercises. Perfect for beginners—start coding today! View More](https://www.scholarhat.com/free-course/c-course-for-beginners?utm_source=training_programs&utm_medium=text&utm_campaign=https://www.scholarhat.com/tutorial/c/operators-in-c "C Programming Course For Beginners") [![C++ Programming Course For Beginners]() C++ Programming Course For Beginners Free Free C++ Online Course with Certification in 2025! Designed for beginners, learn and certify in 21 days. Don’t miss out—register now and start coding! View More](https://www.scholarhat.com/free-course/cpp-course-for-beginners?utm_source=training_programs&utm_medium=text&utm_campaign=https://www.scholarhat.com/tutorial/c/operators-in-c "C++ Programming Course For Beginners") ##### Live Training - Book Free Demo ![](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/netsoftwarearchitectureanddesigntraining-mobile.png) ###### .NET Software Architecture and Design Training 18 Apr • 08:30PM - 10:30PM IST Get Job-Ready • Certification [TRY FREE DEMO](https://www.scholarhat.com/training/software-architecture-design-training?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Live_Class_Schedule&utm_term=/tutorial/c/operators-in-c) ![](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aspnetcorecertificationtraining-mobile.png) ###### ASP.NET Core Certification Training 18 Apr • 07:00AM - 09:00AM IST Get Job-Ready • Certification [TRY FREE DEMO](https://www.scholarhat.com/training/aspnet-core-certification-training?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Live_Class_Schedule&utm_term=/tutorial/c/operators-in-c) ![](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/aidrivenazurefullstacknettechleadcertificationprogram-mobile.png) ###### AI-Driven .NET Tech Lead Program 18 Apr • 07:00AM - 09:00AM IST Get Job-Ready • Certification [TRY FREE DEMO](https://www.scholarhat.com/job-oriented/net-tech-lead-certification-training?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Live_Class_Schedule&utm_term=/tutorial/c/operators-in-c) ![](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/reactcertificationtrainingprogram-mobile.png) ###### React Certification Training 18 Apr • 07:00AM - 09:00AM IST Get Job-Ready • Certification [TRY FREE DEMO](https://www.scholarhat.com/training/reactjs-certification-training?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Live_Class_Schedule&utm_term=/tutorial/c/operators-in-c) ![](https://dotnettrickscloud.blob.core.windows.net/uploads/CourseImages/microsoftcertifiedazuresolutionarchitectexpert-mobile.png) ###### Azure Solution Architect Certification Training 18 Apr • 10:00AM - 12:00PM IST Get Job-Ready • Certification [TRY FREE DEMO](https://www.scholarhat.com/training/microsoft-azure-solution-architect-certification?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Live_Class_Schedule&utm_term=/tutorial/c/operators-in-c) Free Master Classes 17 Apr Become a Multi-Cloud AI Engineer: Build, Train & Deploy AI Systems [Register Now](https://www.scholarhat.com/master-classes/build-train-deploy-ai-systems-multi-cloud?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Upcoming_Master_Class&utm_content=https://www.scholarhat.com/tutorial/c/operators-in-c) 19 Apr Build & Deploy Your First AI App with Python, Azure & AWS [Register Now](https://www.scholarhat.com/master-classes/build-and-deploy-ai-systems-multi-cloud?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Upcoming_Master_Class&utm_content=https://www.scholarhat.com/tutorial/c/operators-in-c) 26 Apr Java Microservices in Production: Spring Boot to AWS Deployment [Register Now](https://www.scholarhat.com/master-classes/java-solution-architect?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Upcoming_Master_Class&utm_content=https://www.scholarhat.com/tutorial/c/operators-in-c) 26 Apr From Monolith to Microservices: Scalable Architecture with .NET, Azure & Kubernetes [Register Now](https://www.scholarhat.com/master-classes/monolith-to-micro-services-architecture?utm_source=Scholarhat&utm_medium=Article&utm_campaign=Upcoming_Master_Class&utm_content=https://www.scholarhat.com/tutorial/c/operators-in-c) ![](https://www.scholarhat.com/images/logo_sm.png) LEAD-ACE: EdTech Platform 100% Live Sessions ![](https://www.scholarhat.com/images/icons/note.svg) 600+ Quick notes ![](https://www.scholarhat.com/images/icons/lab.svg) 900+ Hands-on labs ![](https://www.scholarhat.com/images/icons/project.svg) 50+ Real-world projects ![](https://www.scholarhat.com/images/icons/question.svg) 45+ Interview books #### Job Ready Tracks [.NET & Azure Solution Architect Program](https://www.scholarhat.com/job-oriented/net-azure-solution-architect-certification-training) \| [AI-Driven .NET Tech Lead Program](https://www.scholarhat.com/job-oriented/net-tech-lead-certification-training) \| [AI-Driven Java Tech Lead Program](https://www.scholarhat.com/job-oriented/java-tech-lead-certification-training) \| [AI-Powered Full-Stack .NET Developer Program](https://www.scholarhat.com/job-oriented/full-stack-net-developer-certification-training) \| [Azure AI Architect Program](https://www.scholarhat.com/job-oriented/azure-ai-architect-certification-training) \| [Multi-Cloud AI & GenAI Engineer (Azure & AWS)](https://www.scholarhat.com/job-oriented/multi-cloud-ai-genai-engineer-certification-training) \| [Multi-Cloud AI Architect (Azure & AWS)](https://www.scholarhat.com/job-oriented/multi-cloud-ai-architect-certification-training) #### Popular Live Training [.NET AI & ML Engineer Certification Training](https://www.scholarhat.com/training/net-ai-ml-certification-training) \| [.NET Certification Training](https://www.scholarhat.com/training/net-certification-training) \| [.NET Microservices Certification Training](https://www.scholarhat.com/training/net-microservices-certification-training) \| [.NET Software Architecture and Design Training](https://www.scholarhat.com/training/software-architecture-design-training) \| [Angular Certification Training](https://www.scholarhat.com/training/angular-certification-training) \| [ASP.NET Core Certification Training](https://www.scholarhat.com/training/aspnet-core-certification-training) \| [AWS AI & Gen AI Engineer Certification Training](https://www.scholarhat.com/training/aws-ai-engineer-certification-training) \| [AWS Developer Certification Training](https://www.scholarhat.com/training/aws-developer-associate-certification-training) \| [AWS Solutions Architect Certification Training](https://www.scholarhat.com/training/aws-solution-architect-certification-training) \| [Azure Agentic AI Engineer Certification Training](https://www.scholarhat.com/training/azure-agentic-ai-engineer-certification-training) \| [Azure AI & Gen AI Engineer Certification Training](https://www.scholarhat.com/training/azure-ai-engineer-certification-training) \| [Azure Developer Certification Training](https://www.scholarhat.com/training/microsoft-azure-developer-associate-certification-training) \| [Azure DevOps Certification Training](https://www.scholarhat.com/training/azure-devops-certification-training) \| [Azure Solution Architect Certification Training](https://www.scholarhat.com/training/microsoft-azure-solution-architect-certification) \| [Blazor Certification Training](https://www.scholarhat.com/training/blazor-certification-training) \| [Career Launchpad Program](https://www.scholarhat.com/training/career-interview-coaching-course) \| [Confidence, Communication & Leadership for Software Engineers](https://www.scholarhat.com/training/confidence-communication-leadership-software-engineers) \| [Data Structures and Algorithms Training](https://www.scholarhat.com/training/data-structures-algorithms-certification-training) \| [Java Microservices Certification Training](https://www.scholarhat.com/training/java-microservices-certification-training) \| [Python For Data Science and AI/ML Certification Training](https://www.scholarhat.com/training/python-data-science-ai-certification-training) \| [React Certification Training](https://www.scholarhat.com/training/reactjs-certification-training) \| [The Top 1% Tech Leader Program](https://www.scholarhat.com/training/tech-leadership-training-program) #### Platform - [Live Training](https://www.scholarhat.com/training) - [Free Courses](https://www.scholarhat.com/free-course) - [Hands-on Labs](https://www.scholarhat.com/labs) - [Real-World Projects](https://www.scholarhat.com/projects) - [DSA Problems](https://www.scholarhat.com/problems) - [Quick Notes](https://www.scholarhat.com/quicknotes) - [Free Interview Books](https://www.scholarhat.com/books) - [Corporate Training](https://www.scholarhat.com/corporate-training) #### Company - [About Us](https://www.scholarhat.com/about-us) - [Contact Us](https://www.scholarhat.com/contact-us) - [Terms & Conditions](https://www.scholarhat.com/terms-and-conditions) - [Privacy Policy](https://www.scholarhat.com/privacy-policy) - [Refund Policy](https://www.scholarhat.com/refund-policy) - [Subscription Policy](https://www.scholarhat.com/subscription-policy) - [Verify Certificate](https://www.scholarhat.com/certificate/verify) - [Become An Instructor](https://www.scholarhat.com/become-an-instructor) #### Resources - [Live Training Membership](https://www.scholarhat.com/membership/live) - [Master Classes](https://www.scholarhat.com/master-classes) - [Coding Playground](https://www.scholarhat.com/compiler) - [Skill Tests](https://www.scholarhat.com/skill-tests) - [Job Openings](https://www.scholarhat.com/jobs) - [Mentors](https://www.scholarhat.com/mentors) - [Live Batches](https://www.scholarhat.com/training/batches) - [Reviews](https://www.scholarhat.com/reviews) #### Have any Questions? ###### Course Enquires: - [\+91- 999 9123 502](tel:+919999123502) - [hello@scholarhat.com](mailto:hello@scholarhat.com) ###### Tech Support: - [\+91- 966 7279 501](tel:+919667279501) - [support@scholarhat.com](mailto:support@scholarhat.com) Follow Us © 2026 Dot Net Tricks Innovation Pvt. Ltd. \| All rights reserved \| The course names and logos are the trademarks of their respective owners \| Engineered with in India. We use cookies to make interactions with our websites and services easy and meaningful. Please read our [Privacy Policy](https://www.scholarhat.com/privacy-policy) for more details. [Accept Cookies]()
Readable Markdown
## Operators in C: An Overview Operators in C constitute the building block of the **[C Programming Language Online Course Free](https://www.scholarhat.com/free-course/c-course-for-beginners)**. They act as potent instruments for data manipulation and control flow. For any C programmer, understanding how these operators function is essential. We'll explain the main operator classifications and their importance in this [**C Tutorial**](https://www.scholarhat.com/tutorial/c). To test your theoretical concepts, consider our [**C Programming Course**](https://www.scholarhat.com/course/c-programming-course). ## What are Operators in C language? Operators are special symbols used to perform various mathematical and logical operations on variables and symbols known as `operands`. The application of operators varies depending on the context. So, it is important to understand how each type works to use them effectively when programming in C language. #### Example ``` ``` Here, `“+”` is an operator that performs the addition of two variables of [**data type**](https://www.scholarhat.com/tutorial/c/data-types-in-c-with-example) int. The variables `a` and `b` are known as the operands. ## Types of Operators in C C has a wide range of built-in operators that can be classified into various types according to their functionality. 1. Arithmetic Operators 2. Relational Operators 3. Logical Operators 4. Bitwise Operators 5. Assignment Operators 6. Conditional Operator 7. Miscellaneous Operator ![Operator in C](https://dotnettrickscloud.blob.core.windows.net/article/c/5620250731224228.webp) We can further classify these operators based on the number of operands on which they operate. Now, let us go through all these operators in detail. **Read More - [Top 50 Mostly Asked C Interview Questions and Answers](https://www.scholarhat.com/tutorial/c/c-interview-questions-and-answers)** ### 1\. Arithmetic Operators These operators perform basic mathematical operations like addition, subtraction, multiplication, and division. We will categorize the [arithmetic operators in C](https://www.scholarhat.com/tutorial/c/arithmetic-operators-in-c) into two categories based on the number of operands and then look at their functionality. | | | | | |---|---|---|---| | **Type** | **Operator** | **Name of Operator** | **Functionality** | | Unary | \++ | Increment | Increases the value by 1 | | | \- - | Decrement | Decreases the value by 1 | | | \+ | Unary plus | No change in the operand value | | | \- | Unary minus | changes the negative number to the positive and vice-versa | | Binary | \+ | Addition | Add two values | | | \- | Subtraction | Subtracts one value from the other | | | \* | Multiplication | Multiplies two values | | | / | Division | Divides one by the other value | | | % | Modulus | Finds the remainder after division | Example of Arithmetic Operators in C ``` ``` In the above code in the [**C Compiler**](https://www.scholarhat.com/compiler/c), we have performed all the arithmetic operations on unary as well as binary operands. #### Output ``` ``` ### 2\. Relational Operators [Relational operators in C](https://www.scholarhat.com/tutorial/c/relational-operators-in-c) are also known as Comparison Operators. They compare the values of the two operands. The result of the comparison is either `true` or `false`. If the comparison is true, it returns 1; If the comparison results in false, it returns 0. These are known as [boolean](https://www.scholarhat.com/tutorial/c/boolean-and-static-in-c) values. | | | |---|---| | **Operator** | **Name** | | \== | Equal to | | \> | Greater than | | \< | Less than | | \>= | Greater than or equal to | | \<= | Less than or equal to | | != | Not equal to | #### Example of Relational Operators in C ``` ``` The above code performs all the comparison operations and returns the result in boolean values. #### Output ``` ``` ### 3\. Logical Operators They are used to combine two or more conditions/constraints. It returns either 0 or 1 depending upon whether the expression results in true or false. If the result is `true`, it returns `1` else returns `0`. The [logical operators in C](https://www.scholarhat.com/tutorial/c/c-logical-operators) are used in [decision-making](https://www.scholarhat.com/tutorial/c/if-else-statements-in-c) and [looping statements](https://www.scholarhat.com/tutorial/c/loops-in-c). We will categorize the logical operators into two categories based on the number of operands and then look at their functionality. | | | | | |---|---|---|---| | **Type** | **Operator** | **Name** | **Functionality** | | Binary | && | Logical AND | returns 1(true) if both the expressions/values are true. | | | \|\| | Logical OR | returns 1(true) if one of the expressions/values evaluates to true. | | Unary | != | Logical NOT | Negates the expression and returns 1 or 0. | #### Example of Logical Operators in [C Online Compiler](https://www.scholarhat.com/compiler/c) ``` ``` The above code performs all three logical operations on `a` and `b` i.e. 1 and 0 respectively. #### Output ``` At least one of a or b is false (zero) At least one of a or b is true (non-zero) b is false (zero) ``` ### 4\. Bitwise Operators These operators work on individual bits. The operands are first converted into bits i.e. 0 or 1, and then the calculation is performed on them. We will categorize the bitwise operators into two categories based on the number of operands and then look at their functionality. | | | | |---|---|---| | **Type** | **Operator** | **Name** | | Unary | ~ | One's complement or Bitwise Complement | | | \<\< | Left Shift | | | \>\> | Right Shift | | Binary | & | Bitwise AND | | | \| | Bitwise OR | | | ^ | Bitwise Exclusive OR or XOR | We will look at Bitwise Operators in detail in the section [Bitwise Operators in C](https://www.scholarhat.com/tutorial/c/bitwise-operator-in-c) ### 5\. Assignment Operators These are used to assign values to the variables. The most fundamental [assignment operator in C](https://www.scholarhat.com/tutorial/c/assignment-operator-in-c) is `“=”`. #### Example of Assignment Operators in C ``` ``` In this example, we have assigned the value 10 to the variable `x` using the assignment operator **(=)**. #### Output ``` The value of x is: 10 ``` The following table shows some variants of the assignment operator, `“=”`. | | | | |---|---|---| | **Operator** | **Example** | **Same as** | | \= | x=y | x=y | | \+= | x+=y | x=x+y | | \-= | x-=y | x=x-y | | \*= | x\*=y | x=x\*y | | /= | x/=y | x=x/y | | %= | x%=y | x=x%y | | &= | x&=y | x=x\&y | | \|= | x\|=y | x=x\|y | | ^= | x^=y | x=x^y | | \>\>= | x\>\>=y | x=x\>\>y | | \<\<= | x\<\<=y | x=x\<\<y | ### 6\. Conditional Operator This is also called a `ternary operator`. It works on three operands. The ternary operator is used to execute a set of statements when the test expression is true and another set of statements when the test expression evaluates to false. #### Syntax ``` ``` Here, the testexpression results in a boolean value i.e. 0(true) or 1(false). **If the testexpression evaluates to:** - ****True:**** expression1 before the colon`(:)`executes - **False:** expression2 after the colon`(:)` executes #### Example of Conditional Operator in C ``` ``` #### Output ``` The maximum value is: 10 ``` **We will look at ternary operators in detail in the section [Ternary Operator in C](https://www.scholarhat.com/tutorial/c/ternary-operator-in-C).** ### 7\. Miscellaneous Operator Commas are used to divide expressions in a statement and are a part of C's miscellaneous operator `(,)`. The value of the rightmost expression is returned after evaluating each expression in order from left to right. #### Example ``` ``` In this example in the [**C Editor**](https://www.scholarhat.com/compiler/c), we have shown how to combine several operations into a single statement using the comma operator. Then, it calculates the sum of `a` and `b` and assigns it to `c` after increasing a and b with the notations `a++` and `b++`, respectively. #### Output ``` c = 15 ``` ## Precedence of Operators in C Operator precedence and associativity help us to determine which operators will be given priority when there are multiple operators in the expression. It is the grouping of terms in an expression and decides how an expression should be evaluated. | | | | |---|---|---| | **Category** | **Operator** | **Associativity** | | Postfix | () \[\] -\>. ++ - - | Left to right | | Unary | \+ - ! ~ ++ - - (type)\* & sizeof | Right to left | | Multiplicative | \* / % | Left to right | | Additive | \+ - | Left to right | | Shift | \<\< \>\> | Left to right | | Relational | \< \<= \> \>= | Left to right | | Equality | \== != | Left to right | | Bitwise AND | & | Left to right | | Bitwise XOR | ^ | Left to right | | Bitwise OR | \| | Left to right | | Logical AND | && | Left to right | | Logical OR | \|\| | Left to right | | Conditional | ?: | Right to left | | Assignment | \= += -= \*= /= %=\>\>= \<\<= &= ^= \|= | Right to left | | Comma | , | Left to right | ##### Summary C language's fundamental building block is its operators, which enable a wide range of operations. The basic kinds of operators in C, including arithmetic, relational, logical, bitwise, and assignment operators, have been outlined in this article along with examples from real-world applications for each. For easy reference, we've included a reference table to help you quickly understand operator precedence, which is essential for writing effective and error-free code. For more information, please consider our [**C Certification Course**](https://www.scholarhat.com/course/c-programming-course). ### FAQs The four categories of operators in C are the arithmetic, relational, logical, and assignment operators. In C, the "&=" operator is a compound assignment operator used to conduct a bitwise AND operation between two values and assign the result to the left operand. In C, operators are used to manipulate and control data by performing various operations on it, such as calculations, comparisons, logical operations, and assignments. The order in which operators are evaluated in expressions in C is determined by their operator precedence. It helps prevent confusion and make sure that expressions are accurately evaluated while adhering to mathematical norms. With arithmetic operations adhering to conventional mathematical norms and logical and relational operations producing true (1) or false (0) outputs, operations in C are carried out based on operator precedence and associativity.
Shard76 (laksa)
Root Hash5572162201820126676
Unparsed URLcom,scholarhat!www,/tutorial/c/operators-in-c s443