Can I assign a number to the char? | Sololearn: Learn to code for FREE!
0

Can I assign a number to the char?

For example like this char z = '1'; char a = '5'; If I'm wrong please correct me! ;)

22nd Jun 2019, 5:42 AM
Ankith M Kashyap
Ankith M Kashyap - avatar
2 Respostas
+ 7
You can assign a number to a char, but that's not what you're doing in your post. char z = '1' assigns the char '1' to z. Assigning a number would look like this: char z = 65. That would assign z the char with the ascii value 65 (which should be 'A' if I'm not mistaken)
22nd Jun 2019, 7:08 AM
Anna
Anna - avatar
+ 1
Oh thank a lot mam
22nd Jun 2019, 7:09 AM
Ankith M Kashyap
Ankith M Kashyap - avatar