Programming isn't about line lengths though. It is easy for me to accept that simple things might stretch 50 or more lines, if I have enough reasons. Either because it looks cleaner or because I have many use cases to consider. Take a moment to appreciate how complex you've made the task already -- passcode handles not just password input, but it plays a role in controlling the loop. If you start worrying about line numbers you'll just make things impossible for yourself.I'm just bumfuzzled as to how to initialize all these new char values without making my code 20 lines longer
Normally a C string that contains 8 characters would only handle a 7-character long password. You need room for the terminating '\0' character.
Also, be aware of when you are comparing a single character:
if ( passcode[0] == (char)-1 )
or a whole string:
int result = strcmp( passcode, "someword" );
The semantics of these operations are different.



LinkBack URL
About LinkBacks


