I know the *
operator is overloaded for multiplication and pointing. Is the 3rd use uniary? If so, could someone elaborate?
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.
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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.