c++ - Why does adding a '0' to an int digit allow conversion to a char? -


i've seen examples of on place:

int = 2; char c = + '0'; string s; s += char(i + '0'); 

however, have not yet seen explanation why adding 0 allows conversion.

if @ ascii table, asciitable, you'll see digits start @ 48 (being '0') , go 57 (for '9'). in order character code digit, can add digit character code of '0'.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -