I have the following snippet of code:
int main(int argc, char *argv[])
{
char line[MAXLINE];
long lineno = 0;
int c, except = 0, number =
yes, you are correct.
while(--argc > 0 && (*++argv)[0] == '-')
is scanning the array (of length argc) of command line arguments one by one looking for those starting with a - option prefix. For each of those:
while(c = *++argv[0])
is scanning through the set of switch characters that follow the first - in the current argument (i.e. t and n in -tn, until it hits the string null terminator \0, which terminates the while loop, since it evaluates as false.
This design allows both
myApp -t -n
and
myApp -tn
to both work and be understood as having the options t and n.