title: How to initialize an array of doubles in c++?
body: <p>I realized that in c++ I cannot initialize an array of <code>double</code> with <code>memset</code>. For an integer array I can easily initialize the array using:</p>
  
  <pre><code>int* a = new int[n];
  memset(a, n*n, n*sizeof(int));
  </code></pre>
  
  <p>But how can I initialize an array of doubles in c++?</p>
  
  <pre><code>long double* d = new long double[n];
  memset(d, n*n, n*sizeof(long double)); // does not work
  </code></pre>