I was reading getopt(3) manual (and also check in ls(1) source) and I saw one line of C code, that I couldn't understand how (more importantly why it works).
After processing command line arguments you can see this code
First line is obvious.
On second line, however
argv is array of pointers to char*.
optind is index to the next argv argument.
So why this code works?
After processing command line arguments you can see this code
Code:
argc -= optind;
argv += optind;
On second line, however
argv is array of pointers to char*.
optind is index to the next argv argument.
So why this code works?