text: Q:
  
  Can you explain me the output of following C code?
  
  #include<stdio.h>
  int main()
  {
      int a = 258;
      char *b = &a;
      b++;
      *b =2;
      printf("%d",a);
  return 0;
  }
  
  Value of a is coming out to be 514 but I'm not sure how?!
  
  A:
  
  258 will look something like 00000000 00000000 00000001 00000010 ( on little-endian).
  You then make b point to the "first char" which is 00000010. 
  Now you increment b, because it's of type char it now moves to next addressable char which is 00000001 (the "second" element) and then you change it to 2 which is 00000010.
  So now we have 00000000 00000000 00000010 00000010 which is 514 when read as an int.
  This result is not guaranteed though as on big-endian the result will differ as a whole.
  
  