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)
Labdabeta
182
Posting Pro in Training
Featured Poster
Recommended Answers
Jump to PostYou will see the answer on this page: http://en.wikipedia.org/wiki/Unary_operation
Jump to PostA 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+=5
Here it means d=d+5.
But since it uses 2 operands, its no longer …
All 6 Replies
thines01
401
Postaholic
Team Colleague
Featured Poster
PrimePackster
10
Runaway Poster
mrnutty
761
Senior Poster
PrimePackster
10
Runaway Poster
vijayan121
1,152
Posting Virtuoso
mrnutty
761
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.