title: Is it possible to make some loop which scans always one number and one string more than once? (Part of my homework)
body: <p>so in my CS course we have to make a calculator which reads input and then calculates the result after the = sign has been read.
  Input always consists of one number followed by operator.</p>
  
  <p>I'm now struggling with the way of scanning the input. I want to use some loop which would always store it like:</p>
  
  <pre><code>scanf("%lf %s ", &amp;in, c);
  </code></pre>
  
  <p>Note: the calculator goes one operation after other. Thus in example below the plus sign works only for 20 and 4, and only then the result takes the division sign and gets divided by 8. Then the new result gets negated by 'neg' string.</p>
  
  <p>E.g.: Input: 20 + 4 / 8 neg =
        Output: Result: -3</p>
  
  <p>This is how I tried to solve it. My intention was to make the loop store each number into a new "box" of array, and then to store each string into the new "line" of char array. The 4 in op array is meant to set the max length of the string, because i know that the longest string that can occur is "sqrt". 
  I see that the '\n' in the condition of for is probably useless but can't figure out how to do it...</p>
  
  <p>I'm thinking about using either for, or a while loop.</p>
  
  <pre><code>int main(){
      double in[10];
      char op[5][4];
  
      for(int i=0; i&lt;5;i++){
          scanf("%lf %s ", &amp;in[i], op[i][4]);
      }
  
      printf("%.3f %s", in[0], op[0][0]);
  
  return 0;
  }
  </code></pre>
  
  <p>//just a "skeleton" of the code. There's more to it, but here I submitted just the part that I'm struggling with.</p>
  
  <p>For example if I run this code, I want to write a few numbers followed by operator into the input.
  I expect it to print the first number and string (just to check whether the loop works).</p>
  
  <p>But actually it does absolutely nothing and just gives me some large negative number as a return.</p>