c++ with char

Hi, I need a lil help with my homework.

the main function looks like this:

int main ()
{ char a; a='A';
char b; b=2;
char c = a+b;
cout << "c=" << c;
return 0;
}

When I run the program I get c=C

Can somebody explain why that is?
Every char is represented by a number. see http://www.cplusplus.com/doc/ascii/
'A' = 65, 'C' = 67, so 'A' + 2 = 'C'.
Thank you :)
Topic archived. No new replies allowed.