title: If we give a=123 1st byte of variable a having value 123 but if we give a=1234 then some other value coming
body: <p>When I am giving like this:</p>
  
  <pre><code>int main()
  {
      int a =123;
      char *p =(char*)&amp;a;
      printf("%d\n",*p);
      ++p;
      printf("%d\n",*p);
      ++p;
      printf("%d\n",*p);
      ++p;
      printf("%d\n",*p);
  }
  </code></pre>
  
  <p>I got output like </p>
  
  <pre><code>123
  0
  0
  0
  </code></pre>
  
  <p>But we I gave like this:</p>
  
  <pre><code>int main()
  {
      int a =1234;
      char *p =(char*)&amp;a;
      printf("%d\n",*p);
      ++p;
      printf("%d\n",*p);
      ++p;
      printf("%d\n",*p);
      ++p;
      printf("%d\n",*p);
  }
  </code></pre>
  
  <p>I got output as </p>
  
  <pre><code>-46
  4
  0
  0
  </code></pre>
  
  <p>I was confused in how the system stores the value (123/1234) in 4 bytes of variable a. 
  if it less than 127 then 1st byte occupies the value as what we gave as input(i.w 123).</p>
  
  <p>But if the value is greater than 127 then 1st and 2nd byte of variable a stores different value. Please explain how does it works?</p>