-1
有人可以告诉我,我们将如何评估内部循环指针:*++argv[0]
。数组指针评估
它如何最终从参数中获得第二个字符?
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
while (--argc > 0 && (*++argv)[0] == '-') {
while ((c = *++argv[0])) {
switch (c) {
....
}
...
}
}
}
是否有某种令人信服的理由来编写您不明白的代码?只是不要,这是没有必要的。 –
这种代码的最佳解决方案是使用POSIX ['getopt()'](http://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html) 或GNU ['getopt_long() '](https://www.gnu.org/software/libc/manual/html_node/Getopt-Long-Options.html#Getopt-Long-Options)功能。 –
@HansPassant是的。也许有些时候。 =) – dud3