Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对传递给程序的 argc 数量有疑问, 所以当我检查 argc 时它不等于 2 !! 需要帮助,我该如何解决这个问题?
C 代码片段:
if (2 != argc) { fprintf(stderr, "Usage: %s <port>\n", argv[0]); exit(1); }
不要忘记程序名称本身也算作 arg。
myProgram -flag variable是argc一个3
myProgram -flag variable
argc
3