title: Print value of multiple variables efficiently
body: <p>This is a question that popped into my head when I had to write a program that included multiple variables that each stored a single digit of a number. Let's say I declared several variables in main (or some other function):</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void)
  {
          int n_1 = 1;
          int n_2 = 2;
          int n_3 = 3;
          int n_4 = 4;
          int n_5 = 5;
          /*
          More variables
                  .
                  .
                  .
          followed by multiple printf()s
          */
  
          exit(EXIT_SUCCESS);
  }
  </code></pre>
  
  <p><em>Assume due to some unfortunate circumstances that I need all those separate variables and I cannot use an array or use a different, more efficient solution.</em></p>
  
  <p>If I wanted to print the value stored in each variable, I could of course just print each single variable with a separate call to <code>printf()</code> or a single long call to <code>printf()</code>. But could I achieve the same goal more efficiently. I am especially interested if it is possible to do this in a loop. A solution which is common in scripting languages is using the value of the iterator variable in a <code>for</code> loop to complete the name of the variable given that the name has a fixed structure as in:</p>
  
  <pre><code>for (int i; i &lt; n; ++i) {
          printf("%d\n", n_i);
  }
  </code></pre>
  
  <p>but this will obviously not work in <code>C</code> (and I know why so no need to point this out). So what is the take on this by experienced people?</p>