title: How to print the name of a variable with parameters?
body: <p>I would like to print : <code>table_name[variable_value]</code></p>
  
  <p>by giving ONE input : <code>table_name[variable_name]</code></p>
  
  <p>Let me explain a simpler case with a toy solution based on a macro:</p>
  
  <pre><code>int i = 1771;
  </code></pre>
  
  <p>I can print the <code>variable_name</code> with </p>
  
  <p><code>#define toy_solution(x) cout &lt;&lt; #x ;</code></p>
  
  <p>If I execute </p>
  
  <p><code>toy_solution(i);</code> </p>
  
  <p>"i" will be printed. </p>
  
  <p>Now, imagine there is a well-allocated table <code>T</code>.</p>
  
  <p>I would like to write in the program:</p>
  
  <pre><code>solution(T[i]);
  </code></pre>
  
  <p>and to read on the screen <code>"T[1771]"</code>.</p>
  
  <p>An ideal solution would treat the two cases, that is :</p>
  
  <p><code>ideal_solution(i)</code> would print <code>i</code>.</p>
  
  <p><code>ideal_solution(T[i])</code> would print <code>T[1771]</code>.</p>
  
  <p>It is not important to me to use a macro or a function.</p>
  
  <p>Thanks for your help.</p>