Why use argc and argv ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why use argc and argv ??

14th Sep 2017, 4:31 PM
Pradheepviki😎😀
Pradheepviki😎😀 - avatar
2 Answers
0
tq
14th Sep 2017, 6:08 PM
Pradheepviki😎😀
Pradheepviki😎😀 - avatar
0
argc4  argv[0]gcc  argv[1]-o  argv[2]myprog  argv[3]myprog.c As you can see, the first argument (argv[0]) is the name by which the program was called, in this case gcc. Thus, there will always be at least one argument to a program, and argc will always be at least 1.
14th Sep 2017, 7:12 PM
Rachit
Rachit - avatar