newbie question - checking if a char array stores a number.
Hi
Yeah, it sounds like a strange thing to do " checking if a char array stores a number", and your probably wondering why there'd be a number there anyway. Well, trust me, there is a reason.
The thing that's confusing me, is that I assumed it would be simple enough to check if there was a specific number in a char array like so:
Code:
for ( i=0 ; i<stringlength ; i++){
if ( string[count]==1 ){
printf("One.\n");
}
}
What i'm actually trying to do is a little more complicated than that, but that's the problem simplified. For some reason it's just reading straight passed any 1's and continuing on without printing "one".
I also tried casting it (string[count]) to an integer, but still had no luck.
Please help me out. :)
Thanks,
turmoil