GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

Ask a Question

 

Start Coding Today

   

GeeksQuiz

GeeksforGeeksIDE

Data Structures

Algorithms

Interview Experiences

C Programming

C++ Programming

Java Programming

GATE CS

Books

Bitwise NOT in C++

The bitwise not in c++ is giving weird result.

(~2)=-3.Actually I know the reason the entire bit frame is getting inverted.I need (~2) to be 1 how can this happen.?

This should satisfy for other numbers as well.

asked Jan 10 by nb
edited Jan 10 by nb
...