so I have 3 variables:
char fromAge[4];
char toAge[4];
char age[4];
They can all have a number between 18 and 100 (include 18 and 100). When I give them the follwing values, the following statement is wrong for some reason:
fromAge[4] = 18;
toAge[4] = 100;
age[4] = 25;
if (strcmp(age, fromAge) >= 0 && strcmp(age, toAge) <= 0)
{
//actions
}
It thinks "age" isn't smaller or equals to "toAge". Any suggestions for why?
edit: This is how I assign the variables, I leave 1 byte for '\0'
scanf("%s", fromAge);
scanf("%s", toAge);
and age is 2,5,'\0'