As studied earlier, Operators are the symbols, which performs operations on various data items known as operands. For Example: in a a+b
, a
and b
are operands and +
is an operator.
Note:- To perform an operation, operators and operands are combined together forming an expression. For example, to perform an addition operation on operands a and b, the addition(+) operator is combined with the operands a and b forming an expression.
In C programming the special operators are mostly used for memory related functions.
Operators | Description |
---|---|
& | This is used to get the address of the variable. Example: &a will give address of a. |
* | This is used as pointer to a variable. Example: *a where, * is pointer to the variable a. |
Sizeof () | This gives the size of the variable. Example: size of (char) will give us 1. |
In this program, “&” symbol is used to get the address of the variable and “*” symbol is used to get the value of the variable that the pointer is pointing to. Please refer C – pointer topic to know more about pointers.
value is: 20