casting char* to int in c

March 3, 2011 at 17:21:54
Specs: Windows 7
how to convert char* into int in C

See More: casting char* to int in c

Report •


#1
March 3, 2011 at 17:29:08
You don't convert the pointer itself to an int.

You can cast individual chars to ints (i.e the numerical value in ASCII/ANSI) or use something like atoi() to convert a c string to an int.


Report •

#2
March 3, 2011 at 17:42:48
if i have the following:
char* s="123";
int a;
how to make the value of 'a' equals 123 ?

Report •

#3
March 3, 2011 at 18:03:11
a = atoi(s);


Report •
Related Solutions


Ask Question