Explaining Special Operators in C Programming
Special Operators in C Programming
Several special operators are used in C Programming language such as:
- Comma operator (, )
- Size of operator
- pointer operators (& and *)
- member selection operators (. and ->)
Comma Operator is used to linking the related expressions together. The expressions using a comma to link each other are evaluated left to right and the rightmost expression is the value of the combined expression. These operators are used in for loops
or while loops. For example,
x = (a = 5, b = 5, a + b)
Size of Operator:
It is a compile time operator that returns the number of bytes occupied when used with an operand. The operand may be a variable, a constant or a data type qualifier.
a = size of (long int);
b = size of (total);
The size of operator is normally used to determine the length of an array or structure, when their sizes are not known to the programmer. It is also used during execution of a program to dynamically allocate memory to variables.