Reputation: 33
I know the *
operator is overloaded for multiplication and pointing.
Is the 3rd use uniary? If so, could someone elaborate?
Upvotes: 1
Views: 746
Reputation: 2034
From what I know:
First use: to declare a pointer:
int * ap;
ap
is an integer pointer.
*ap
gives the value stores at the address pointer to by the pointer ap
.int a = 5*2;
Upvotes: 0
Reputation: 212
When used as the pointer dereference operator it is a unary operator.
This is because in that context, it only takes one argument, namely the pointer.
You do see * in 5 contexts (other than quoted strings):
In (1) and (2) and (3), it is acting as an operator. C++ allows you to overload operators.
Upvotes: 3