C Programming - Bitwise Operators - Discussion
Discussion Forum : Bitwise Operators - Find Output of Program (Q.No. 10)
10.
What will be the output of the program?
#include<stdio.h>
int main()
{
printf("%d %d\n", 32<<1, 32<<0);
printf("%d %d\n", 32<<-1, 32<<-0);
printf("%d %d\n", 32>>1, 32>>0);
printf("%d %d\n", 32>>-1, 32>>-0);
return 0;
}
Discussion:
42 comments Page 4 of 5.
Madhureddy said:
1 decade ago
Hi friends, can any body explain it to me I'm helpless ?
Siva said:
1 decade ago
Tell me the value of 60 and ~60 same how? explain now.
NITESH said:
1 decade ago
Ok so -1 is being treated here as 256. Thanx Atul.
Monisha said:
10 years ago
How is it possible to get 32>>1=16?
Tej said:
1 decade ago
-1>>(any number). You get -1 not 0.
Venkatesh said:
8 years ago
32<<-1 is equal to 32<<FFFF.
Ankita said:
7 years ago
How to convert -0 to its 2's complement?
Sangharsh said:
2 decades ago
How is 32 << -1 is equal to 0 ?
Nikita said:
1 decade ago
2's comp of -1 is 1, how 256?
Regi said:
1 decade ago
Can any one explain clearly?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers