Hi guys,
I'm having trouble with the following function, can anyone spot whats wrong, I can't get atoi to work, the only work around thus far is doing this which I don't particularly like
I want to be able to use atoiCode:if ( isdigit( x ) ) return (x - 48);
Code:int get_coord(char x) { const char cols[10] = "ABCDEFGHIJ"; int i; if ( isdigit( atoi(&x) ) ) return x; for ( i = 0; i < 10; i++ ) { if ( x == cols[i] ) return i; } }