title: Store int inside char array in C
body: <p>I am trying to store int value in char array, and access it again to retrieve value later. here is what i tried, but it is not working as i am looking for.  </p>
  
  <pre><code>char mem[50];
  int* size = (int*)&amp;mem[0];
  
  char* isFree = (char*)&amp;mem[4];
  
  char *t = (char *)&amp;mem[4];
  </code></pre>
  
  <p>Now I want to store 1234, and 'f' in the char array according to the order. (within first 5 bytes)</p>
  
  <p>I am not allowed to use other variables, have to use char array. </p>
  
  <pre><code>int a = 1234;
  int *size = &amp;a;
  </code></pre>
  
  <p>above one is not allowed.</p>