"atoi" error?!?!

1
2
3
4
5
6
7
8
for (int count = 0; count < length; count++)
    {
        if (isdigit(expression[count]))
		{
			
			 //temp = atoi(expression[count]);
             mystack.push(temp);
		}        

The commented line keeps giving me this error
error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Did do something wrong with the "atoi"??
Thanks in advance!
You are trying to convert one character to a number.
atoi takes in a string such as "66" and turns it into a number (66).
You have to have a C-style string.
char* expression[2] = {"123", "342"};

If you are trying to get the ascii value try this:
temp = (int)expression[count];
Last edited on
Great help!
Thanks a lot!! =P
Topic archived. No new replies allowed.