Hii Learners’
Here in this blog will will learn about the operators in C programming. Before start with operators we need to know about terminologies such as expression, operators, and operators.
Expression: Expression is a combination of operators, variables, and constants.
Let us suppose that the following is an expression:
Operands: In computing and mathematics, an operand is an object that is operated on by an operator. An operand is a number, a variable that represents a number, or an expression that returns a number.
Operator: In the above expression, you can see that an operator is a mathematical or logical symbol that triggers an action when applied to operands.
Classification of Operators: Based on minimum number of operands an operator is required to act on, operators can classified into following three categories.
Types of Operators
- Arithmetic Operators
- Relational Operators
- Equality Operators
- Logical Operators
- Conditional Operators
- Assignment Operators
- Comma Operator
- sizeof Oeprator
- Bitwise Operators
/**********************************************
Example of Operators in C programming
Author: Charanpreet kaur
Date: 6.9.2023
***********************************************/
#include <stdio.h>
int main()
{
//Relational Operator
int a=20,b=20;
printf("%d",a<b);//0--true
printf("%d",a>b);//0--false
printf("%d",a<=b);//1--true
printf("%d",a>=b);//1--false
//comparison operation
printf("%d",a==b);//1--true
printf("%d",a!=b);//0--false
//Assignment Operator
a=30;
printf("%d",a!=b);//1--true
//logical Operator
printf("%d",a<b && a==30);//0
printf("%d",a<b || a==30);//1
printf("%d",!a);//0
//Assignment Operator
a=b=40;
printf("\nValue of a is %d \nvalue of b is %d",a,b);
return 0;
}