cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Convert char to int (not ASCII)
Convert char to int (not ASCII)
Feb 24, 2012 at 10:01am UTC
SuperStinger
(84)
I want to convert a char to an int.
e.g.
char theChar '9';
int theInt = theChar;
would this be the way to do it, i heard its only for 0 to 9, so how would i do it for an interger like 365??
Last edited on
Feb 24, 2012 at 10:20am UTC
Feb 24, 2012 at 10:14am UTC
Alexandru098
(1)
i don't get it.
if you want to transform a char to an int, simply put:
1
2
3
char
c=
'9'
;
int
i; i=c;
if you want to transform a digit into a number, use this:
i=c-
'0'
;
Feb 24, 2012 at 10:20am UTC
SuperStinger
(84)
k thanks
Topic archived. No new replies allowed.