C Programming - Bitwise Operators - Discussion

Discussion Forum : Bitwise Operators - Find Output of Program (Q.No. 6)
6.
What will be the output of the program?
#include<stdio.h>

int main()
{
    printf("%d >> %d %d >> %d\n", 4 >> 1, 8 >> 1);
    return 0;
}
4 1 8 1
4 >> 1 8 >> 1
2 >> 4 Garbage value >> Garbage value
2 4
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
36 comments Page 3 of 4.

Mukesh said:   1 decade ago
2 >> 4 rest depends on the compiler..

Prat said:   9 years ago
Why garbage value? Please explain clearly.

Vandana said:   8 years ago
Thank you for all the given explanation.

Ashwini said:   8 years ago
Please explain, why garbage value occur?

Maya said:   1 decade ago
Why shouLd we right shift to one place?

Chinnu said:   1 decade ago
What is mean by rest is garbage. ?

Suyog said:   9 years ago
Can anybody explain about garbage?

Harshal said:   7 years ago
Thanks for explaining the answer.

Praba said:   9 years ago
What is mean by rest is garbage?

Bhagyshri said:   1 decade ago
gcc 32 is compiler in unix o.s.


Post your comments here:

Your comments will be displayed after verification.