Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

C++ understanding the main()


ghost's Avatar
0 0

I am into my book quite aways. And i have come across the "Understaning the main." in my complier the main is like so..

in main(int argc, char *argv[])

K this is what i understand so far. int argc - represents the # if the command line parameters.

ex. nmap -i ...

the nmap is the proram name and the -i is a parameter and also the ip ??? am i right so far ???

the second part i dont get at all the "char *argv[]" this part i do not understand in the book i tells me that is is and arry and thats it i dont know what is does plz explain ty for your time.

zer0pian


ghost's Avatar
0 0

argc is the counter to how many arguments and argv[] is the array containing the arguments

and yes the ip is an argument as well


ghost's Avatar
0 0

what do u mean by containg???


ghost's Avatar
0 0

You know what an array is? It's like a wallet wich contains multiple things of the same type

Like argv[] is an array containing multiple char*'s


ghost's Avatar
0 0

ty i get ty 4 your time

zer0pain