In the following syntax:
int main(int argc, char const*argv[])
can you please explain me the significance of the arguments inside the main function?
Some doubts in C++
@Tiwary725
To pass command line arguments, we typically define main() with two arguments : first argument is the number of command line arguments and second is list of command-line arguments.
- argc (ARGument Count) is int and stores number of command-line arguments passed by the user including the name of the program. So if we pass a value to a program, value of argc would be 2 (one for argument and one for program name)
- argv(ARGument Vector) is array of character pointers listing all the arguments.