title: Copying 1KB Byte array to single variables using memcpy. Looking for smarter way
body: <p>I have a byte array <code>arr</code> of size 1024 and 4 variables into which I want to copy the beginning of array <code>arr</code>.
  Later I want to read more data from the array. What would be the best and most dynamic way to achieve this? At the moment I am just copying bytes statically. Maybe a pointer that is set to the current reading position automatically?
  Thanks!  </p>
  
  <pre><code>unsigned char arr[1024];
  unsigned char field1 = 0;
  unsigned int field2 =0;
  unsigned int field3 = 0;
  unsigned char field4 = 0;
  
  memcpy(&amp;field1, arr,    sizeof(field1));
  memcpy(&amp;field2, arr[1], sizeof(field2));
  memcpy(&amp;field3, arr[5], sizeof(field3));
  memcpy(&amp;field4, arr[9], sizeof(field4));
  </code></pre>