<<< Character Literals | Index | sizeof operator >>> |
In memory, everything is just bits; type is what gives meaning to the bits
(bits/binary) 01100001 is the int 97 is the char 'a' (bits/binary) 01000001 is the int 65 is the char 'A' (bits/binary) 00110000 is the int 48 is the char '0'
Using character as an integer:
char ch = 'a'; cout << ch; // print the value of character: prints a int num = ch; cout << num; // print the integer value of // the character: prints 97
<<< Character Literals | Index | sizeof operator >>> |