Apparently, when I use the unsigned right shift operator (>>>), I receive an error during compilation.
I am using MinGW.
Is this operator not available in C? If so, what would be the equivalent to this?
Thank you,
abraham2119
Apparently, when I use the unsigned right shift operator (>>>), I receive an error during compilation.
I am using MinGW.
Is this operator not available in C? If so, what would be the equivalent to this?
Thank you,
abraham2119
There is no >>> in C. If your variable is unsigned, it should happen automatically with >>.
There is unfortunately no >>> operator in C or C++ (though there is in other languages like Java).
The >> operator does what you are expecting. On signed integers, the >> may do sign-extension or it may do an unsigned shift, depending on the implementation. For signed integers, if you need one particular behaviour, you can emulate it yourself with other bitwise operators.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.