title: Alternative to memcpy
body: <p>I am using an Arduino to parse UDP packages sent from an application on my local network. The messages contain 36 bytes of information. The first four bytes represent one (single-precision) float, the next four bytes another one, etc.</p>
  
  <p>The Arduino function udp.read() reads the data as chars, and I end up with an array</p>
  
  <pre><code>char data[36] = { ... };
  </code></pre>
  
  <p>I am now looking for a way to convert this into the corresponding nine floats. The only solution I have found is repeated use of this trick:</p>
  
  <pre><code>float f;
  char b[] = {data[0], data[1], data[2], data[3]};
  memcpy(&amp;f, &amp;b, sizeof(f));
  </code></pre>
  
  <p>However, I am sure there must be a better way. Instead of copying chunks of memory, can I get away with using only pointers and somehow just tell C to interpret b as a float?</p>
  
  <p>Thanks</p>