Monday, May 24, 2010

How do you change a character "1234" into it's numerical value in C?

In C, how do I change characters into Decimal values so I can use them to perform arithmetic operations with.


For example changing char '234' into decimal number 234

How do you change a character "1234" into it's numerical value in C?
use atoi





char[]="123";


int x=atoi(y);
Reply:The function you're looking for is called "atoi", and it's in the C standard library.
Reply:gets()





?








Not sure though...


No comments:

Post a Comment