title: how to use scanf to scan double and char at the same time into a double array in C
body: <p>I have a project to do which asks me to record the address of two vectors into a double array according to user's input. However. For example, if user writes</p>
  
  <blockquote>
  <pre><code>3  
  1 2 3  
  3 4 5
  </code></pre>
  </blockquote>
  
  <p>it means that the vectors are 3 dimensional and the two vectors are <code>(1,2,3)(3,4,5)</code>. If user writes,</p>
  
  <blockquote>
  <pre><code>2  
  1 2  
  2 3  
  </code></pre>
  </blockquote>
  
  <p>it means that the vectors are 2 dimensional and the two vectors are <code>(1,2)(2,3)</code>. I need to record the coordinates of these two vectors into two double arrays x, and y. How can I read the coordinates into these two arrays using scanf? (I don't know if the user writes in the correct format, it's possible for them to write letter or other symbol at the place where they are supposed to just write number. If they write chars other than number, i need to return -1.)</p>
  
  <p>my code so far is  </p>
  
  <pre><code>double x[100];  
  char c;   
  c = getchar();  
  do {  
  scanf("%lf",x)}  
  while (c!= '\n');  
  </code></pre>