x

C – Special Operators

Prev     Next

Special Operators in C:

Below are some of the special operators that the C programming language offers.


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.

Example program for & and * operators in C:

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.

Output:

50

Example program for sizeof() operator in C:

sizeof() operator is used to find the memory space allocated for each C data types.

Output:

Storage size for int data type:4
Storage size for char data type:1
Storage size for float data type:4
Storage size for double data type:8

Continue on types of C operators:

Click on each operator name below for detailed description and example programs.


Types of Operators 
Description
Arithmetic_operators These are used to perform mathematical calculations like addition, subtraction, multiplication, division and modulus
Assignment_operators These are used to assign the values for the variables in C programs.
These operators are used to compare the value of two variables.
These operators are used to perform logical operations on the given two variables.
These operators are used to perform bit operations on given two variables.
Conditional operators return one value if condition is true and returns another value is condition is false.
These operators are used to either increase or decrease the value of the variable by one.
&, *, sizeof( ) and ternary operators.

Prev     Next



Like it? Please Spread the word!