C Programming - Bitwise Operators - Discussion

2. 

In the statement expression1 >> expression2. if expression1 is a signed integer with its leftmost bit set to 1 then on right shifting it the result of the statement will vary from computer to computer

[A]. True
[B]. False

Answer: Option A

Explanation:

No answer description available for this question.

Super said: (Nov 15, 2010)  
why? i cant understand

Santhu said: (Feb 28, 2011)  
In turbo c integer takes 2-BYTES,
In linux integer takes 4-BYTES.

turbo c: 1000 0000 0000 0000 0000>>1==>>0100 0000 0000 0000
the above value equalent to: 35,767

Linux: 1000 0000 0000 0000 0000 0000 0000 0000>>1
the above value is equalent to: 2,147,483,647

This is the main reason

Nagarjun said: (Mar 11, 2011)  
thank u Santhu

Salluu said: (Sep 3, 2012)  
Thank you bhai.

Geek said: (Aug 18, 2013)  
Since it is signed and leftmost bit is 1, whatever be the size of t int 1's will get filled from the left,

So I think answer is [B]. False.

Harry_Monk said: (Jan 19, 2014)  
How you compute the value @Santhu?

Arup said: (Jan 17, 2015)  
I think result of the statement will vary from compiler to compiler.

Dhanraj said: (Sep 5, 2015)  
100% sure checked on GCC compiler of Indiabix.

Kavi said: (Aug 4, 2016)  
Thank you.

Ami Tiwari said: (May 9, 2017)  
Thanks for all the given explanation.

Nia Sharma said: (Aug 31, 2018)  
Thank you all for explaining it.

Ruhi said: (Oct 26, 2018)  
I am not understanding this. Please, someone, help me.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.