Skip to content

Instantly share code, notes, and snippets.

@nscooling
Created October 23, 2014 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nscooling/36b5750b25313b45e22a to your computer and use it in GitHub Desktop.
Save nscooling/36b5750b25313b45e22a to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <limits.h>
#include <assert.h>
int main(void)
{
assert(sizeof(unsigned char)==1);
unsigned char uc1 = 0xff;
unsigned char uc2 = 0;
if(~uc1 == uc2) {
printf("%08x == %08x\n", ~uc1, uc2);
} else {
printf("%08x != %08x\n", ~uc1, uc2);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment