What is the result of attempting to compile and run the program? Answer is 31,0. Can anyone explain me the exact pen and paper calculation for the same.As I feel the calculation will be pretty hectic, considering that int is 32 bit.
thanxs a lot for the nice explanation!! Just wanted to confirm one thing, that in case of integers, for shifting lowest 5 bits are used and in case of shifting of long, lowest 6 bits are used? Are these the only two cases?Meaning no other special cases where the no. of bits vary?
Hi, Those are the only possiblities.All other types byte,short,char are promoted to int.
The type promotion is applied to both the operators separately. The resulting type and number of bits shifted depends only on the type of the L.H.S operator. Hope this helps.... -vinu. [ May 19, 2005: Message edited by: vinuharan haran ]
Don't get me started about those stupid light bulbs.