I have a quick question about the check_flag function in sort race. Just looking for a hint or advice to lead me in the right direction. I cant quite figure out how to reference the argv values. I get errors when i try to use argv, also if i try to str. There is no main in helpers.c, so i am wondering where the flag values are at this point in the process. Thanks so much for any consideration, I'm new to this, so sorry if i missed any protocols in this question. G-REG
The code comment "Returns true if str is a valid flag (-a, -b, -r, or -s), false otherwise" indicates you would use
str to determine validity. In C, strings cannot be compared directly as in
if (str == "-a") or you will get the error
error: result of comparison against a string literal unspecified (use strncmp instead) as mentioned in the comment. You would need to use the
strcmp function, which you can review with
man strcmp. Or perhaps recall
caesar where strings were processed as individual characters (hint, hint).