I am trying to write a function to accept command line arguments. On Google search i got so many hits for that, but all use command line arguments with main function, something like below.
#include <iostream>
int main(int argc, char** argv) {
std::cout << "Have " << argc << " arguments:" << std::endl;
for (int i = 0; i < argc; ++i) {
std::cout << argv[i] << std::endl;
}
}
If i already have a main function and I want to write another function, later callable in main or any other program, how to write that, i.e function with user defined name.