Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>double *t; double *x; double *y; double *z; </code></pre> <p>As Erik said, there is no need to make those pointers, unless you want to make them point to other variables or want to malloc or calloc them. You can simply do:</p> <pre><code>double t; double x; double y; double z; </code></pre> <p>But this is also a little weird:</p> <pre><code>for (i = 0; i&lt;(sizeof(x)/sizeof(double)); ++i) </code></pre> <p>Where did you see that? It is sometimes used to get the number of items in an array:</p> <pre><code>len = sizeof(myArray)/sizeof(myArray[0]); </code></pre> <p>but x is not an array, in your code it is a pointer, and probably smaller than a double, so the result of the division is 0 and chances are high the loop will not run at all. Assuming you meant the entire indented code to be looped over, you also forgot the { and } to surround the block, so the loop will only perform the first line of that "block".</p> <p>Then you try to <strong>cast</strong> a double into a string (hence the warnings), but that is not how it works, as it will merely try to <em>reinterpret</em> the value in the double as a pointer to a char, which is certainly not what you want, and it is unnecessary, since <code>fprintf</code> will take care of that for you:</p> <pre><code>fprintf(outputFile, "%f\t%f\t%f\n", x, y, z); </code></pre> <p>The loop and the fact you are using pointers make me think you are trying to loop over something, but it is not entirely clear what you actually want to achieve. Could you explain what you actually want to do?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload