关于int main( int argc, char* argv[] ) 中arg和argv参数的解析及调试

https://blog.csdn.net/LYJ_viviani/article/details/51873961

 

https://stackoverflow.com/questions/3024197/what-does-int-argc-char-argv-mean

#include <iostream>

int main(int argc, char** argv) {
    std::cout << "Have " << argc << " arguments:" << std::endl;
    for (int i = 0; i < argc; ++i) {
        std::cout << argv[i] << std::endl;
    }
}

g++ main.cc 编译后

运行他将./test a1 b2 c3输出

posted @ 2019-04-29 17:48  clemente  阅读(237)  评论(0编辑  收藏  举报