What does int main(int argc, char *argv[])
mean?
argv
and argc
are how command-line arguments are passed to main.
-
argc
(argument count)- The number of argument strings pointed to by
argv
- Should just be
- The number of argument strings pointed to by
-
argv
(argument vector)- List of arguments
These are only called argc
and argv
by convention, could just as well be int main(int num_of_args, char **arg_strings)
or something.
int main()
with no arguments can be used if you don’t intend to pass process command line arguments.
Example: