How to print a variable's name in C++?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1623111/programmatic-way-to-get-variable-name-in-c">Programmatic way to get variable name in C?</a>  </p>
</blockquote>



<p>I have checked some of the blogs before posting this here. I have tried the following snippet...</p>

<pre><code>int a=21;

int main()
{
   cout&lt;&lt;#a&lt;&lt;a&lt;&lt;endl;
   return 0;
}
</code></pre>

<p>I am using g++ compiler on ubuntu 10.04. And I am getting the following error:</p>

<pre><code>sample.cpp:17: error: stray ‘#’ in program. 
</code></pre>

<p>Please suggest me how to print the variables name .</p>
