In C programming, operators are symbols that perform operations on operands. These operands can be variables, constants, or expressions. Here are some common operators in C:
Arithmetic operators: Perform arithmetic operations like addition, subtraction, multiplication, division, and modulus. For example, +, -, *, /, %.
Relational operators: Compare two operands and return a result of true (1) or false (0). For example, == (equal to), != (not equal to), > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to).
Logical operators: Perform logical operations on two operands and return true (1) or false (0). For example, && (logical AND), || (logical OR), ! (logical NOT).
Assignment operators: Assign a value to a variable. For example, =, +=, -=, *=, /=, %=.
Increment and Decrement operators: Increase or decrease the value of a variable by 1. For example, ++ (increment), -- (decrement).
Bitwise operators: Perform operations on individual bits of integers. For example, & (bitwise AND), | (bitwise OR), ^ (bitwise XOR), << (left shift), >> (right shift), ~ (bitwise NOT).
Conditional operator (ternary operator): A shorthand for if-else statement. For example, condition ? expression1 : expression2.
Comma operator: Evaluates multiple expressions and returns the value of the last expression. For example, expr1, expr2.
Resources :
Test Your Knowledge
Choose The
With supporting text below as a natural lead-in to additional content.