Introduction:
In C programming language, operators are symbols that are used to perform various operations on variables and values.
There are several types of operators in C, including:
- Arithmetic operators: These operators are used to perform mathematical operations such as addition, subtraction, multiplication, division, and modulus. The arithmetic operators in C include the plus sign (+), minus sign (-), asterisk (*) for multiplication, forward slash (/) for division, and percent sign (%) for modulus.
- Relational operators: These operators are used to compare two values and return a boolean value (true or false) depending on the result. The relational operators in C include the equal sign (==), not equal sign (!=), greater than sign (>), less than sign (<), greater than or equal to sign (>=), and less than or equal to sign (<=).
- Logical operators: These operators are used to perform logical operations such as AND, OR, and NOT. The logical operators in C include the AND operator (&&), the OR operator (||), and the NOT operator (!).
- Assignment operators: These operators are used to assign a value to a variable. The assignment operator in C is the equal sign (=), and there are also compound assignment operators such as the plus-equal sign (+=) and the minus-equal sign (-=).
- Bitwise operators: These operators are used to perform bitwise operations on binary numbers. The bitwise operators in C include the AND operator (&), the OR operator (|), the XOR operator (^), the left-shift operator (<<), and the right-shift operator (>>).
Understanding operators is a fundamental concept in C programming, and they are essential for performing operations on data and creating complex programs.
Expression
In C programming language, an expression is a combination of one or more operators, variables, constants, and function calls that evaluate to a value.
Expressions in C can be simple or complex and can include arithmetic, relational, logical, and bitwise operators. Some examples of expressions in C are:
- Simple arithmetic expression: a + b
- Complex arithmetic expression: 5 * (a + b) / c
- Relational expression: a > b
- Logical expression: x && y
- Bitwise expression: a | b
- Function call expression: printf("Hello, world!");
Expressions in C can be used in various contexts such as assignment statements, if-else statements, loops, and function calls. For example, an expression can be assigned to a variable:
int result;
result = a + b;
if (a > b) {
    printf("a is greater than b");
} else {
    printf("b is greater than a");
}
#include<stdio.h>
int main() {
   int a = 10;
   int b = 20;
   int c;
   c = a + b;  // addition
   printf("a + b = %d\n", c);
   c = a - b;  // subtraction
   printf("a - b = %d\n", c);
   c = a * b;  // multiplication
   printf("a * b = %d\n", c);
   c = b / a;  // division
   printf("b / a = %d\n", c);
   c = b % a;  // modulus
   printf("b %% a = %d\n", c);
   
   return 0;
}a + b = 30
a - b = -10
a * b = 200
b / a = 2
b % a = 0
- Operators are symbols that are used to perform various operations on variables and values.
- C programming language supports various types of operators such as arithmetic, relational, logical, assignment, and bitwise operators.
- Arithmetic operators in C include the plus sign (+), minus sign (-), asterisk (*) for multiplication, forward slash (/) for division, and percent sign (%) for modulus.
- Relational operators in C compare two values and return a boolean value (true or false) depending on the result. They include the equal sign (==), not equal sign (!=), greater than sign (>), less than sign (<), greater than or equal to sign (>=), and less than or equal to sign (<=).
- Logical operators in C perform logical operations such as AND, OR, and NOT. They include the AND operator (&&), the OR operator (||), and the NOT operator (!).
- Assignment operators in C are used to assign a value to a variable. The assignment operator in C is the equal sign (=), and there are also compound assignment operators such as the plus-equal sign (+=) and the minus-equal sign (-=).
- Bitwise operators in C perform bitwise operations on binary numbers. They include the AND operator (&), the OR operator (|), the XOR operator (^), the left-shift operator (<<), and the right-shift operator (>>).
- Expressions in C are a combination of one or more operators, variables, constants, and function calls that evaluate to a value.
- Expressions can be simple or complex and can include arithmetic, relational, logical, and bitwise operators.
- Understanding operators is a fundamental concept in C programming, and they are essential for performing operations on data and creating complex programs.

