Can argc be zero on a POSIX system?
Given the standard definition for the main program: int main(int argc, char *argv[]) { ... } Under which circumstances can argc be zero on a POSIX system? Yes, it is possible. If you call your program as follows: execl("./myprog", NULL, (char *)NULL); Or alternately: char *args[] = { NULL }; execv("./myprog", args); Then in "myprog", argc will be 0. The standard also specifically allows for a 0 argc as noted in section 5.1.2.2.1 regarding program startup in a hosted environment: 1 The function called at program startup is named main . The implementation declares no prototype for this function.