argv[argc] ==?

2020-01-25 08:13发布

My professor and a couple of students are arguing about whether argv is null terminated or not. My friend wrote a small program and it printed out null but another kid said that he is probably simply reading into blank memory. Can someone solve this discussion?

标签: c argv
2条回答
聊天终结者
2楼-- · 2020-01-25 08:38

From the Standard:

5.1.2.2.1 Program startup
...
-- argv[argc] shall be a null pointer.

So, yes; argv is null terminated

查看更多
迷人小祖宗
3楼-- · 2020-01-25 08:55

According to the standard, "argv[argc] shall be a null pointer" (5.1.2.2.1).

查看更多
登录 后发表回答