BM Balmiki Mandal 28 Dec 2022 1 views 0 comments C Programming

Write a one line code to compare the two integer numbers using bitwise operator.

Learn how to compare integer numbers using bitwise operators in C

To compare two integer numbers using bitwise operator in C and return a boolean value (1 for true and 0 for false), you can use the following one line code:

int isEqual = (num1 ^ num2) == 0;

where num1 and num2 are the two integer numbers being compared, and ^ is the bitwise XOR operator. This code compares the two numbers bitwise and returns 1 if they are equal, and 0 otherwise.

0 Comments

No comments yet, Be the first to comment.

Post a Comment

Please sign in to post a comment.

Related Posts

Bit wise operators Assignment

Bitwise Operators practical assignment: Take runtime input, bit-level manipulation, and different data units r...

AG Anvesh G 27 Sep 2026
Understanding Float and Double Binary Representation in C

Understanding Float and Double Binary Representation in CIntroduction:When we store decimal numbers such as 10...

AG Anvesh G 31 May 2026
Topic-wise C Programming Interview Questions

C Programming Interview Questions – Topic Wise1. IntroductionC programming is one of the most important langu...

AG Anvesh G 30 May 2026