+ 1
C++ argc argv
how can use these arguments(argc,argv) in any function ? (no main function) somthing like this: int hello(int argc,char **argv){ return argc; } hello ("hi","hello",hey"); //output 3 hello ("hi"); //output 1
6 ответов
+ 2
https://code.sololearn.com/cgZMln6swhg2/?ref=app
quick example..try search on google for detail
+ 1
do you mean u want to pass any amount of arguments?
+ 1
try to consider function overloading first cause its the easiest
other way is to use variadic function/template..it is a little bit complex but worth learning
+ 1
Can you give me example?
+ 1
argc argv are just parameters you can have them in any function but its not going to get called automatically. You should call the thing and pass values yourself
0
Yes like *args python