When can argv[0] have null?

前端 未结 4 909
失恋的感觉
失恋的感觉 2020-11-29 05:15

What I have understand about passing arguments to main() from command line is that argc has a minimum value of 1 and argv[0] will always have the program name with its path

4条回答
  •  感动是毒
    2020-11-29 05:46

    It's possible to imagine platforms where programs do not have names - perhaps the code is simply loaded at startup. On those, argv[0] could I guess be NULL. The C Standard certainly allows an argc value of zero, and says that argv[argc] shall be NULL.

提交回复
热议问题