Operators are unique symbols that are employed to carry out certain tasks or activities. Both unary and binary options are possible.An example of an operator and a binary operator is the asterisk (*), which is used to accomplish multiplication in the C programming language.All sorts of operators are covered in this section.
Arithmetic Operators Mathematical operations like addition, subtraction, etc. are carried out using arithmetic operators. Several of the basic arithmetic operators include
We must all already be familiar with their usage in elementary mathematics. They serve the same role and have the same goal.Let’s see how they are implemented in C.
#include <stdio.h>
int main()
{
int a = 2;
int b = 3;
printf("a + b = %d\n", a + b);
}
Output: a + b = 5
Operators in Relation
When comparing two or more integers or even expressions, relational operators are utilised. Similar to Java, C provides six relational operators that can return either True or False as their return value (1 or 0).
#include <stdio.h>
int main()
{
int a = 2;
int b = 3;
printf("a == b = %d\n", a == b);
}
output: a == b = 0