C11 Standard 5.1.2.2.1 shows
If they are declared, the parameters to the main function shall obey the following constraints:
The value of argc shall be nonnegative. argv[argc] shall be a null pointer.
--
C++ n3337 draft 3.6.1 also
2 ...argc shall be the number of arguments passed to the program from the environment in which the program is run. .... The value of argc shall be non-negative. The value of argv[argc] shall be 0.
Because of this, in C/C++, it is always argv[argc]==NULL
. As you said, argc is not a necessary function.
But thanks to argc, I don't have to go around the loop Isn't it a useful function in that you can check how many factors came in right away?
© 2024 OneMinuteCode. All rights reserved.