+ 3
Function main has two implemented parameters: int argc and char * argv[], but can take other parameters too. It is useful if you want to make for example script and run it by: Unix: ./program arg1 arg2 ... or Windows: program.exe arg1 arg2 ... From cppreference.com: argc - Non-negative value representing the number of arguments passed to the program from the environment in which the program is run. argv - Pointer to the first element of an array of pointers to null-terminated multibyte strings that represent the arguments passed to the program from the execution environment (argv[0] through argv[argc-1]). The value of argv[argc] is guaranteed to be a null pointer.
6th Apr 2018, 3:21 PM
Bartosz Pieszko
Bartosz Pieszko - avatar