title: Someone can explain the code?
body: <p>I have to assign to the variable "j" value of the variable "i" using only a pointer to char. I couldn't write code, so I see this solution but I don't understand what happen in the "for" body. Can someone explain it to me? </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;math.h&gt;
  
  int main(int argc, char **argv) {
  int i = 10;   
  int j = 20;  
  char *p, *q;  
  
  p = (char*)&amp;i;   
  q = (char*)&amp;j;
  
  for(int k = 0; k &lt; sizeof(i); ++k) {  
      *(q + k) = *(p + k);    
  }
  
  printf("%d == %d\n", i, j); 
  
  return 0;
  }
  </code></pre>