[Solved] ASCII code printing logic


See, as in your program you haven’t initialised char c;

It must be initialised or hold some value before being printed!

   int i; char c;
   i = 1;
   cout << c << endl;     // initialsise c=something of char-type;
   c = i;
   cout << c << endl;     //as initialised,so prints something

Second, as you have initialised this char variable c. Hence,it prints some symbol,probably an ASCII character!

3

solved ASCII code printing logic