+ 4
A simple solution would be to cast it to an integer then add 48 to it. I assume you're having a digit as a character and want to find it's equivalent integer. It'll be like below: char c='8'; int i=((int)c)+48;//the value of c is now 8 Note: This only works meaningfully if the character is a digit, else it gives meaningless result
13th Jan 2022, 12:51 PM
Rishi
Rishi - avatar