title: Passing the value of a variable to macro in C
body: <p>I'm trying to pass the value of a variable to a macro in C, but I don't know if this is possible. Example:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  #define CONCVAR(_n) x ## _n
  
  int main () {
     int x0, x1, x2, x3, x4, x5, x6, x7, x8, x9;
     int i;
  
     for (i = 0; i &lt;= 9; i++) CONCVAR(i) = i*5;
  
     return 0;
  }
  </code></pre>
  
  <p>Here, I'm trying to use a macro to assign a value to all x_ variables, using <code>##</code> tokens. I know I can easily achieve this with arrays, but this is for learning purposes only.</p>
  
  <p><code>CONCVAR(i)</code> is substituted to <code>xi</code>, not <code>x1</code> (if i == 1). I know how defines and macro work, it's all about substitution, but I want to know if it is possible to pass the value of i instead the letter <code>i</code> to a macro.</p>