<p>For example:</p>

<pre><code>int a = 12;
cout &lt;&lt; typeof(a) &lt;&lt; endl;
</code></pre>

<p>Expected output:</p>

<pre><code>int
</code></pre>

Try:
```
```
#include <typeinfo>

// …
std::cout << typeid(a).name() << '\n';
```
```
You might have to activate RTTI in your compiler options for this to work. Additionally, the output of this depends on the compiler. It might be a raw type name or a name mangling symbol or anything in between.