I am really confused as to the purpose of the unary + operator. What in the world does it do? I have tested it and it doesn't return the absolute value. Does it just return the operand? And if so what purpose is it?! (I mainly care about integer types)
Jump to Post
A single +, it just tells the compiler that it is a positive value.
+3 means 3 is positive, thats all
Well about usage of +, there is short hand methods in C++, Like this;
d+=5Here it means d=d+5.
But since it uses 2 operands, its no longer …
All 6 Replies
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.