Hello.
User enters 11111111 into my convert program and wants it to be converted to its
signed decimal representation (-1 will be output on stdout)
I read that string above into an unsigned int (32-bit on my comp) with strtoul()
strtoul puts it in the variable like this:
00000000 00000000 00000000 11111111 <--------- 255
I want to turn all and ONLY bits above the most significant to 1 to turn that variable into
ULONG_MAX. Then I will use printf to print it as -1 to stdout (what user expected in this
case).
Question is --> Is there a shift operation to do this in C? I know there's a shift
operator, but can it just set the bits above the most significant?
Thanks alot