title: To create a program that divides two numbers at equal intervals
body: <p>I made the first part of the program, but I don't understand the part of dynamic memory allocation and calculation using pointers. What should I coding?
  <strong>The contents of the program.</strong></p>
  <ol>
  <li>Consider creating a sequence of numbers by dividing the two numbers
  at equal intervals. For example, if you want to create 5 numbers
  that are evenly spaced from 0.0 to 2.0, you can divide the interval
  from 0 to 2 into 4 equal parts (considering the value at the end)
  and arrange the numbers every 0.5. It becomes 0.0, 0.5, 1.0, 1.5,
  2.0.</li>
  <li>Then, when you enter the first number, the last number, and the
  total number of values, an array containing the values ​​at equal
  intervals from the &quot;first number&quot; to the &quot;last number&quot; is created by
  dynamic memory allocation, and each value is created. After
  displaying, create a program (see execution example) that also
  displays the square of each value.</li>
  <li>The &quot;first number&quot; and &quot;last number&quot; are floating-point numbers, and
  the &quot;total number of values&quot; is an integer. The memory allocated by
  dynamic memory allocation should be the minimum required according
  to the &quot;total number of values&quot;. Display each value At the first
  display, output the value stored in the array as it is.</li>
  </ol>
  <p>my source code</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
      
      int main ()
      {
         int num, i;
         double dfirst, dlast;
         double * x;
      
         / * Enter the first value, the last value, and the number to divide * /
         printf (&quot;Input first, last, total number of x []:&quot;);
         scanf (&quot;% lf% lf% d&quot;, &amp; dfirst, &amp; dlast, &amp; num);
      
         / * Create after this * /
      
         / * Allocate memory * /
      
        / * Determine the value to store.
           Be careful not to divide by an integer and decide the number of divisions in consideration of the end value * /
      
         / * Display results * /
      
         / * Post-processing * /
         return 0;
      }
  </code></pre>
  <p>Execution result want to do</p>
  <pre><code>% ./a.out
  Input first, last, total number of x[]: 0.0  2.0  5
  Values of x
  0.000 0.500 1.000 1.500 2.000
  Values of x^2
  0.000 0.250 1.000 2.250 4.000
  % ./a.out
  Input first, last, total number of x[]: 1.0  2.0  11
  Values of x
  1.000 1.100 1.200 1.300 1.400 1.500 1.600 1.700 1.800 1.900 2.000
  Values of x^2
  1.000 1.210 1.440 1.690 1.960 2.250 2.560 2.890 3.240 3.610 4.000
  </code></pre>