On Monday 09 August 2010 13:22:20 Avik Mitra wrote:
> ANSI standard specifies that during right shift of a negative number
> the shift MUST be a logical shift with sign extension. So, 1111 1111
> 1111 1111 when right shifted will logically with sign extention it
> gives FFFF (in hex).
> So the answer is [A].

Dave is right. Quoting from C99 (the _current_ ANSI C standard): "The result 
of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
or if E1 has a signed type and a nonnegative value, the value of the result is 
the integral part of the quotient of E1 / 2^E2 . If E1 has a signed type and a 
negative value, the resulting value is implementation-defined."

-- 
Mihai Donțu

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to