1,184 views

1 Answer

1 1 vote
as -1 will be represented as 2's complement form

therefore -1 = 1111 1111 in 2's complement (assuming 8 bit representation)

hence -1<<1 will shift above binary bits left by 1

i.e -1<<1 = 1111 1110

therefore result will be "fe" in hexadecimal

or you may also get fffe for 16 bit representation or  ffff fffe for 32 bit representation but hexadecimal value of last 4 least significant bits  will always be 'e' and remaining preceding value will be 'f'
Position:
Show:

Related questions

1 1 vote
0 0 answers
2.6k
2.6k views
Ashish Roy 1 asked Mar 16, 2019
2,604 views
In the above 4 Statements which would print 123 as output ? Explain also.
0 0 votes
2 2 answers
937
937 views
Parshu gate asked Sep 26, 2017
937 views
0 0 votes
0 0 answers
1.1k
1.1k views
Gatetarget_100 asked Aug 3, 2018
1,053 views
int main() { int a[10]; printf("%d",*a+1-*a+3); return 0; }Answer is given as 4 but i think it should be 8, if int is of 4 byte. Correct me if i am wrong
0 0 votes
0 0 answers
552
552 views