+ 1

c++ char

Hey guys, So while doing the course i got stuck with char i don't understand it because if i do this char test = 'ab' cout <<'ab'; it prints out a 4 digit number but when i do char test = 'a'; cout <<'a'; it prints a. it's probally super easy but i just don't get it lol hope you guys can help me :). bye

7th Oct 2017, 11:47 PM
Jordi
Jordi - avatar
3 Answers
+ 13
maybe it printed out the ascii value of the letters
8th Oct 2017, 12:28 AM
Jobelle
Jobelle - avatar
+ 1
thx i really don't know it yet but i'il find out
10th Oct 2017, 8:42 PM
Jordi
Jordi - avatar
0
The char data type is supposed to just be a single character, such as 'a', 'b', or 'x.' I really don't know how you managed to get a 4 digit number (I'm pretty bad at C++), but you did appear to forget a semicolon after the "char test = 'ab'" line.
7th Oct 2017, 11:54 PM
LunarCoffee
LunarCoffee - avatar