c - Calculation of Bit wise NOT -


how calculate ~a manually? seeing these types of questions often.

#include <stdio.h> int main() {     unsigned int = 10;     = ~a;     printf("%d\n", a); } 

the result of ~ operator bitwise complement of (promoted) operand
c11dr §6.5.3.3

when used unsigned, sufficient mimic ~ exclusive-or uint_max same type , value (unsigned) -1. @eof

unsigned int = 10; // = ~a; ^= -1; 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -