C Programming - Bitwise Operators - Discussion

Discussion Forum : Bitwise Operators - Find Output of Program (Q.No. 4)
4.
If an unsigned int is 2 bytes wide then, What will be the output of the program ?
#include<stdio.h>

int main()
{
    unsigned int a=0xffff;
    ~a;
    printf("%x\n", a);
    return 0;
}
ffff
0000
00ff
ddfd
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
47 comments Page 5 of 5.

Ranjit said:   2 decades ago
Can any explain why ~operator has no effect here?

Nirlep said:   1 decade ago
~a does not assigned any where yaar
so simple

Pratik said:   1 decade ago
Can you explain in detail how answer is a?

Poulami said:   1 decade ago
What is the meaning of 0x..?

Rishabh said:   1 decade ago
What does 0xffff means here?

Lakshmi said:   8 years ago
Thanks for explaining it.

Madhukar said:   1 decade ago
Yes taruna is right.


Post your comments here:

Your comments will be displayed after verification.