开发者

argv[argc] ==?

开发者 https://www.devze.com 2023-01-17 09:05 出处:网络
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 pro开发者_Go百科

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 pro开发者_Go百科bably simply reading into blank memory. Can someone solve this discussion?


From the Standard:

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

So, yes; argv is null terminated


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

0

精彩评论

暂无评论...
验证码 换一张
取 消