I'm still new to C as I'm trying to understand it some more.
Today I was comparing pieces of content from my char array to numbers (see example below) and it didn't seem to work unless I used their respective ASCII code, so my question is:
Is there another way of comparing the content of a char array for example with a number (except for making the number a local variable) ?
Input = 1
char test [10]; scanf("%s", test); if (test[0] == 1) { puts("True"); }
While this one did work
char test [10];
scanf("%s", test);
if (test[0] == 49) {
puts("True");
}
Thanks in advance!