title: Convert double to Char Array C++
body: <p>I'm trying to convert (and round) a double to a char array without converting with a std::to_string on the double first. However, I'm receiving random memory text instead. What am I doing wrong? </p>
  
  <p>Here is my code:</p>
  
  <pre><code>double d = 1.0929998; 
  d = std::round(d * 100) / 100;
  
  char s[sizeof(d)];
  std::memcpy(s,&amp;d,sizeof(d));
  </code></pre>
  
  <p>Result:</p>
  
  <blockquote>
    <p><strong>s:</strong> q=×£pñ?</p>
  </blockquote>
  
  <p>Intended value: </p>
  
  <blockquote>
    <p><strong>s:</strong> 1.09</p>
  </blockquote>