I know for sure that there are two command-line arguments in C -- argc
and argv[]
, but while taking an online test, I figured out that there are 3 command line arguments in C. Can someone please explain to me this.
Asked
Active
Viewed 553 times
-1

ifconfig
- 6,242
- 7
- 41
- 65
-
3Your use of the term "command-line arguments" is mildly confusing. You are probably thinking of "how many arguments are there to the `main()` function?" — in which case you should see [What should `main()` return in C and C++?](https://stackoverflow.com/questions/204476/what-should-main-return-in-c-and-c/18721336#18721336) for the details. Note that Annex J of the standard recognizes a variant `int main(int argc, char **argv, char **envp)`. Apple provides a fourth parameter, `char **apple`. Etc. – Jonathan Leffler Jul 30 '19 at 04:41
-
You are talking about this: https://stackoverflow.com/questions/29909115/are-there-any-other-arguments-that-main-can-accept – Deanie Jul 30 '19 at 05:38
1 Answers
0
As many as you want. argv[]
is a char*
array of all of the arguments passed and argc
is an integer count of the elements in argv[]
. Related TutorialsPoint article

ifconfig
- 6,242
- 7
- 41
- 65