1
00:00:05,010 --> 00:00:10,320
Now, next topic is command line arguments in C++.

2
00:00:11,410 --> 00:00:20,620
So in case of common main arguments, we will be actually using the concept for suppose I have a program

3
00:00:21,130 --> 00:00:26,930
and in the start of the program, it said it without even running the program.

4
00:00:26,950 --> 00:00:33,130
I want to supply some variables or arguments to that program from my testimony.

5
00:00:33,700 --> 00:00:34,060
OK.

6
00:00:34,420 --> 00:00:41,530
From my command, from the from from my bash, whatever operating system we are using from that terminal.

7
00:00:41,530 --> 00:00:49,690
If I want to supply some variables to C++ program, then it's very easy to use command line arguments.

8
00:00:50,080 --> 00:00:56,260
So we will be using command line while we are writing the main function of the program.

9
00:00:56,710 --> 00:01:00,020
So there are two command line arguments in ARGs.

10
00:01:00,070 --> 00:01:08,950
C and Java Star R V and at C will count how many things you are passing while you are running the program.

11
00:01:09,340 --> 00:01:15,480
And are we use actually the number of arguments which you can get with the program?

12
00:01:15,530 --> 00:01:22,500
You can give any number of program arguments if that program is accepting that number of arguments so

13
00:01:22,540 --> 00:01:29,080
axes use for it's an integer variable and store the number of command line arguments possibly that you

14
00:01:29,080 --> 00:01:31,220
set, including the name of the program.

15
00:01:31,260 --> 00:01:37,120
It's actually it will count from the name of the program, so name of the program is one argument.

16
00:01:37,390 --> 00:01:43,300
So if you pass one value to a program, that value vaccine will be two.

17
00:01:43,330 --> 00:01:51,070
Because one is argument, which we have based and run this for program, meet the value of our C should

18
00:01:51,070 --> 00:01:52,080
be nor negative.

19
00:01:52,870 --> 00:01:54,670
Then are we sorry?

20
00:01:54,670 --> 00:01:57,520
Updated this one listing all the arguments.

21
00:01:57,520 --> 00:02:02,320
So if Odyssey is greater than zero, that it is wrong, I agree.

22
00:02:03,170 --> 00:02:12,520

23
00:00 See my half agree c minus one will convert blind us to string are we of zero will be the name

24
00:02:12,520 --> 00:02:13,270
of the program.

25
00:02:13,570 --> 00:02:15,100
After that, they are.

26
00:02:15,100 --> 00:02:17,830
We are C minus one will be our elements.

27
00:02:17,830 --> 00:02:20,550
What all elements we pass will be coming after that.

28
00:02:20,680 --> 00:02:26,200
So why do we need to pass something to a program before it's getting executed?

29
00:02:26,380 --> 00:02:34,510
It's because sometimes we need to execute a program by without without any havoc, like without going

30
00:02:34,510 --> 00:02:35,520
inside the program.

31
00:02:35,520 --> 00:02:39,670
We want to execute that program with some defined values, right?

32
00:02:39,850 --> 00:02:43,360
So in that case, we would be using a command line carbons.

33
00:02:43,510 --> 00:02:45,480
So it's kind of our for it.

34
00:02:45,640 --> 00:02:52,210
So if it's better to understand, do that like before you execute that program while you are just running

35
00:02:52,210 --> 00:02:55,750
that program, you will be able to supply some values into that program.

36
00:02:55,930 --> 00:03:01,300
And for that, you have to use this for syntax indexing in your main function.

37
00:03:01,480 --> 00:03:04,150
And that main function is holding two arguments.

38
00:03:04,360 --> 00:03:10,270
One is I see that's a simple argument which will show you how many number of hours when you are passing

39
00:03:10,270 --> 00:03:17,110
into the program and Gustav, oddly victor, it's actually an error which will show what are the things

40
00:03:17,110 --> 00:03:22,000
you passed into that program that all things will be stored as an array in sight?

41
00:03:22,500 --> 00:03:24,730
Are we OK now?

42
00:03:24,910 --> 00:03:26,260
Nothing more to discuss.

43
00:03:26,270 --> 00:03:30,940
Let's go to that demo of this one and see how this is working.

44
00:03:31,240 --> 00:03:35,070
So I had a five part command line or CPB.

45
00:03:35,080 --> 00:03:43,050
Here I have the C defined out here and got to start stop RV also to find out here.

46
00:03:43,240 --> 00:03:48,220
So how you can do this without even entering the the program?

47
00:03:48,220 --> 00:03:50,110
I'm trying to compile it first.

48
00:03:50,720 --> 00:03:58,060
C++, cmb line dark CBB right now while I'm executing Dodge Slash.

49
00:03:58,180 --> 00:04:05,390
Usually we use it outright, but instead of here dart out, I'm planning to give some other values.

50
00:04:05,410 --> 00:04:07,750
OK, so I'm gaming main.

51
00:04:07,990 --> 00:04:10,450
Then I'm planning to use some values inside.

52
00:04:11,030 --> 00:04:17,560
Arguably, I suppose one values one and so it should be different values.

53
00:04:17,560 --> 00:04:21,520
You can pass it your back to League One by using it space.

54
00:04:21,820 --> 00:04:29,300
So one variable will be main, then another variable may be one I space another maybe would be DC.

55
00:04:29,560 --> 00:04:33,670
Another way may be happy on that score line.

56
00:04:34,240 --> 00:04:40,750
So you again see how many variables I'm getting actually giving in to the program without even going

57
00:04:40,750 --> 00:04:41,590
into the program.

58
00:04:41,920 --> 00:04:44,500
One two three four.

59
00:04:45,020 --> 00:04:46,170
No, I need output.

60
00:04:46,330 --> 00:04:47,440
It should be fired, right?

61
00:04:47,470 --> 00:04:52,570
How many I believe will be in dirt that will be fired, why it should be fired.

62
00:04:52,840 --> 00:04:58,980
It's because one before I have passing and one is actually the programming.

63
00:04:59,110 --> 00:05:03,790
Now I am going to execute C like that is a small Z index setup.

64
00:05:03,850 --> 00:05:10,680
Before that D plus plus I have to improve my mode parameter Typekit all then I.

65
00:05:11,290 --> 00:05:16,710
The main function, because it's like main function will be that starting.

66
00:05:16,800 --> 00:05:20,940
OK, now I need to do that second statement.

67
00:05:21,030 --> 00:05:25,410
Now you showing how many arguments I have endured into the program.

68
00:05:25,770 --> 00:05:28,040
It's one two three four.

69
00:05:28,050 --> 00:05:30,360
It's like you have ended four arguments.

70
00:05:30,360 --> 00:05:32,880
It will be the value of moxie, right?

71
00:05:33,040 --> 00:05:34,670
They're printing oxygen here.

72
00:05:34,920 --> 00:05:39,060
And one by one, we are printing out of the army first.

73
00:05:39,070 --> 00:05:41,970
Outgoing Dodge flash me second argument.

74
00:05:42,300 --> 00:05:44,280
One third argument.

75
00:05:44,310 --> 00:05:45,890
ABC bought argument.

76
00:05:46,290 --> 00:05:46,750
Happy.

77
00:05:47,880 --> 00:05:53,430
OK, this is all about command line arguments in C++.
