Set double-list from starndard input numbers


/ Published in: C
Save to your folder(s)

e.g.
<pre><code>
seq 10 | ./a.out
</code></pre>


Copy this code and paste it in your HTML
  1. #include <stdio.h>
  2.  
  3. #define MAX (512*512)
  4.  
  5. int main(int argc, char **argv)
  6. {
  7. int i, n=0;
  8. double v[MAX];
  9.  
  10. do i=scanf("%lf", v+n);
  11. while(i==1 && n++<MAX);
  12.  
  13. /* as you please */
  14.  
  15. return 0;
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.