C Programming - Bitwise Operators - Discussion

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

int main()
{
    unsigned int m = 32;
    printf("%x\n", ~m);
    return 0;
}
ffff
0000
ffdf
ddfd
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
35 comments Page 3 of 4.

Naveen said:   1 decade ago
But in the compiler provided by the indiabix.com.

The output is ffffffdf.

Can anyone explain why?

Preeti said:   1 decade ago
Binary representation of 32bit - 0000000000100000.

1's - 1111111111011111.

So ffdf answer.

Zakar said:   7 years ago
32 complement = 1111 1111 1101 1111.

In hexadecimal f f d f.
(3)

Chelsi said:   1 decade ago
How did you took m=32 as in binary: 0000 0000 0010 0000 please explain me?

Raina said:   1 decade ago
HOW TO WRITE .

32 = 0000 0000 0010 0000.

Can anyone explain this?

Vinod said:   1 decade ago
"%x" represents hexadecimal. How to print a number in binary form?
(1)

Shilpa said:   1 decade ago
Thanks Neetu & Sudheer Kumar Raina, very well explianed.

Vignesh said:   1 decade ago
What does "f"&"d" mean and any thing others.

Jayakrishana said:   1 decade ago
Thanks for you explanation Sudheer Kumar Raina.

Shruti said:   1 decade ago
How 32 is 0000 0000 0010 0000 ?


Post your comments here:

Your comments will be displayed after verification.