+ 1
What are int argc and char *argv[] for?
So I've only been working with console applications in C++, and I've always left the main function clear of parameters (I declare it as int main()). However, since I've recently tried to get into Qt, I've realized that the main function can have parameters as follows: int main(int argc, char *argv[]) I would highly appreciate a simple approach to explaining this since I've already looked it up and I can't wrap my head around it.
2 Réponses
+ 14
argv[]argument vector: it is a character array.
argc-argument counter : means no of values u can insert in argv[].
but it is not compulsory to use argv[] and argc as main() function argument u can use any other ordinary variable but first variable for counter and second char variable for data.
- 1
argv[] is a list of stuff
I believe it has
the file name
string argument
external file
like 20% on that.... lol I've also never used them :/