title: How to assign an integer to a variable of type char
body: <p>I'm not doing something right here.</p>
  
  <p>This is my code:</p>
  
  <pre><code>#include&lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
    char a='2Z';
    cout&lt;&lt;a&lt;&lt;endl;
    return 0;
  }
  </code></pre>
  
  <p>But only <code>Z</code> is printed and not the <code>2</code> proceeding it. How can print the integer too?</p>