Quantcast
Channel: Int - Char.....Why is it legal?
Viewing all articles
Browse latest Browse all 6

Int - Char.....Why is it legal?

$
0
0
The code below y will return 72. I never knew we can do that, I mean, I understand char is just a code for the character.  But never thought it is legal to minus a char from an int.  Can someone elaborate?

int y = 120; y -= '0';

return y;


Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images