+ 4

What would be the output ?

// what would be the output ?? #include <stdio.h> int main() { int x; x=~5; printf("%d",x); return 0; }

6th Feb 2020, 5:49 AM
Rohit Upadhyay
Rohit Upadhyay - avatar
4 Respuestas
+ 1
-6
7th Feb 2020, 3:34 AM
Deepak Schweinsei Pokharel
Deepak Schweinsei Pokharel - avatar
+ 4
Thanxx..i'll check it...😊
6th Feb 2020, 12:30 PM
Rohit Upadhyay
Rohit Upadhyay - avatar
+ 3
https://stackoverflow.com/questions/3952122/what-does-tilde-operator-do Tilde operation is well explained here... Well you could have tried running the code in code playground..
6th Feb 2020, 6:03 AM
$hardul B
$hardul B - avatar
+ 2
The ~ operator in C++ (and other C-like languages like C and Java) performs a bitwise NOT operation - all the 1 bits in the operand are set to 0 and all the 0 bits in the operand are set to 1. In other words, it creates the complement of the original number. For example: 10101000 11101001 // Original (Binary 01010111 00010110 // ~Original (Binary The bitwise NOT operator has an interesting property that when applied on numbers represented by two's complement, it changes the number's sign and then subtracts one (as you can see in the above example)
6th Feb 2020, 12:39 PM
Rohit Upadhyay
Rohit Upadhyay - avatar