title: Why do unsigned int x = -1 and int y = ~0 have the same binary representation?
body: <p>In the following code segment what will be:</p>
  
  <ul>
  <li>the result of function</li>
  <li>value of x </li>
  <li>value of y</li>
  </ul>
  
  <pre>
      {
           unsigned int x=-1;
           int y;
           y = ~0;
           if(x == y)
               printf("same");
           else
               printf("not same");
       }
  </pre>
  
  <pre>
  a. same, MAXINT, -1
  b. not same, MAXINT, -MAXINT
  c. same , MAXUINT, -1
  d. same, MAXUINT, MAXUINT
  e. not same, MAXINT, MAXUINT
  </pre>
  
  <p>Can someone explain me how its works or can just explain the snippet??</p>
  
  <p>I know it's about two's complement n etc..
  What is the significance of MAXINT and -1 ?
  It is because of unsigned int and int thing - am I right ?</p>