Question

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?

Was it helpful?

Solution

From the Standard:

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

So, yes; argv is null terminated

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top