Gads. -1 != "-1" != '-1' ... but then there is no char literal '-1' ! Perhaps the single-quotes was a misleading mistake.
Either way, the user has no way to to cause a char to take on a -1 integer value when being read in as a string.
So
Code:
if(passcode == negOne)
will not work the way you expect it to. This will evaluate the first character in the passcode string with the value of -1, which it can't be as I stated.
In your case, the user can enter -1 but it will be the string "-1", and you will need to use strcmp(), not the equality operator, ==, to determine if the strings are equal.
Code:
char passcode[ 8 ] = {0};
A string is always terminated by the '\0' character, which is equivalent to zero, so it is non-printable. In other words, there is a character on the end of every string that you do not see when printing. The bottom line being that you need to account for that extra character which will be appended to your string.
Code:
char maxlim = 99999999;
char minlim = 10000;
Even a 2 byte char would have an upper limit of 65,536. Again, a misunderstanding of char vs string (array of chars). I think what you intended was
Code:
char maxlim[] = "99999999";
char minlim[] = "10000";
Then you would have strings to compare to your passcode string. But here's the rub,
Code:
strcmp( "99", "19999999" )
will return a value indicating that 99 > 199999999 because it is comparing ASCII values, on a char by char basis. So, while this works to check for "-1", it will not help you in your range test.