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 5 of 5.
Udit said:
6 years ago
Please explain the following in the code.
1. 32>>-0
2. 32<<-0
1. 32>>-0
2. 32<<-0
NJ Nath said:
6 years ago
32>>-1 and 32<<-1 are compiler dependent questions, in gcc compiler both values are showing as 16 and 62 respectively.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers