In a language like C an Operators is a symbolic code that imposes an operation over either single or a group of operands C supports the following three type of Operators.
Unary Operator
Binary Operator
Ternary Operator
Unary Operator
Operators that require only one operand are called Unary Operators . For Example-: ++i; //this statement inccreases the value of i by 1 Here ++ -: is an Operators whereas "i" is an Operand.
Binary Operator
These Operators requires atleast two operands. However, there is no maximum limit of Operands. Most of the C opearators are of binary types. For example -: Mathematical and Relational Operators. x=a+b Here ,a and b are operands and = and + Symbols are Operands
Ternary Operator -:
The only major Operators of ternary type is the conditional Operators requires atleast 3 operands . Example-: ____?_____:______ Here, ? and : are Operators.
List of Operators in C.
Mathematical Operators
Relational Operators
Logical Operators
Increament and decreament Operators
Conditional Operators
Assignment Operators
Size of Operators
Miscellaneous Operators
Mathematical Operators
We have a total of 5 mathematical Operators that are given in C these are " + , - , * , / , % " Priority of Mathematical Operators -:
First priority-:  ()
Second priority-:  /,%,*
Third priority-:  +,-
C puts only 3 levels of priority when an expression comes with two or more Operators of different priorities the Operators of high priority will be entertained first. In case of two or more Operators having same priority, the first encountered will be entertained first. For Example -: 2+3*6-7+9/3 2+18-7+9/3 2+18-7+3 20-7+3 13+3 16
Relational Operators
Operators that show relationships between two operands are called relational Operators these are -: <,>,<=,>=,==,!= For Example-: int x,y,z; x=5; y=6; z=x>=y;
Note-:
The above expression will return a Boolean value (0 for false and 1 for true).
Logical Operators
Logical Operators introduce binary logic to the C language. It works on boolean values as well. The major use of logical operations is when we have to check two or more conditions at a time curently. These are of three types-:
Logical AND(&&)
Logical OR(||)
Logical NOT(!)
Logical AND -:
Logical AND is written as (&&) it checks two condition simultaneously and performs the following logical operations.
In C increament and dcreament Operators are used to increase or decrease the value of a variable the increament Operators is (++) and Decreament is (--) The increament and decreament Operators are further classified in two types-:
Conditional Operators requires three operands the first operand is always a condition .the second operand activates whwn condition is true and third operand activates when condition is false.
For Example-: int a=5,x; x=(a>2)?(a-1):(a+1);
Asiignment Operators-:
It is a binary Operators hence it requires two operands. The right Operand to this Operators is always transferred to the left operand. For Example-: int x; x=5;
Sizeof Operators-:
Size of Operators reflects the size in bytes of either a variable or a data type or a constant.
For Example-:
int x,y; y=sizeof(x) or y=sizeof(int)
Miscllaneous Operators:-
C supports some other Operators as well and every Operators has its own usage.
Address Operators-:
This Operators reflects the adress of a variable ie stored somewhere in the memory For Example-:
int x; x=6;
printf("%d",x); printf("%u",&x);
Comma Operators-: Comma Operators can be used to distinguish two or more assignment statement. It can also be used while displaying different variables. This Operators is used in variable declaration as well.
Program that adds every digit of a four digit number-: