1 00:00:00,120 --> 00:00:01,870 Next part of the story. 2 00:00:04,220 --> 00:00:11,810 So one more theoretical portion, the values which we lost, two functions are called arguments. 3 00:00:12,350 --> 00:00:14,870 So here again, see on the previous slide. 4 00:00:15,990 --> 00:00:20,370 See, here I have Indiana in B. 5 00:00:20,700 --> 00:00:24,090 These are all arguments and arguments are of two types. 6 00:00:24,120 --> 00:00:25,290 Let's see what is next. 7 00:00:26,980 --> 00:00:32,860 So there are two types of arguments, actually, and for me, let's jump back good clean with our program 8 00:00:32,860 --> 00:00:36,570 to see water actually arguments and what that formal arguments. 9 00:00:37,390 --> 00:00:48,160 So if you look into our program here, I have just given my arguments like my first number is number 10 00:00:48,160 --> 00:00:55,000 one and my first second number is number two, and I have botched this to that addition function. 11 00:00:55,270 --> 00:00:59,500 So this is Carl and Boston that children use to the function. 12 00:00:59,770 --> 00:01:12,280 So these arguments are actual are going so number one and number two, I can't actual arguments and 13 00:01:12,280 --> 00:01:15,070 we have formal arguments also here. 14 00:01:15,370 --> 00:01:21,800 Number one and number two are coming all here and it's now it's name is changed to Hannity right now. 15 00:01:21,940 --> 00:01:22,750 One is store two. 16 00:01:22,750 --> 00:01:23,150 Yeah. 17 00:01:23,170 --> 00:01:24,610 And number two is still to be. 18 00:01:24,850 --> 00:01:33,670 So now you can be archived formal arguments in the court for many arguments. 19 00:01:35,290 --> 00:01:40,300 I think it makes sense to you why they have got it, because they saw the arguments which you are passing 20 00:01:40,300 --> 00:01:44,170 to the function and these are the copy of that particular arguments. 21 00:01:45,600 --> 00:01:53,970 No, another important topic, which we have s car by rally and car by reference. 22 00:01:55,630 --> 00:02:02,800 So here we have three types of ways which we again face value to function. 23 00:02:03,310 --> 00:02:05,020 One is by value. 24 00:02:05,500 --> 00:02:09,520 Second is buys bad press and third is buys Bank of Finance. 25 00:02:11,240 --> 00:02:18,530 So what is the difference between two, so supposing by sending out the value, then the copy of the 26 00:02:18,530 --> 00:02:20,600 values passed with that function? 27 00:02:21,320 --> 00:02:27,320 But if I'm basing the value we on convey that our friends make the list, we will check how it will 28 00:02:27,320 --> 00:02:27,980 actually work. 29 00:02:28,070 --> 00:02:29,570 So don't worry about that. 30 00:02:29,840 --> 00:02:36,260 So if I'm posting evaluate their function, better friends or leader, I presume the function that value 31 00:02:36,260 --> 00:02:44,090 spots to that function whenever there is a change in value in that function inside that function. 32 00:02:44,330 --> 00:02:48,260 It is not reflected in that value because it's scarred by value. 33 00:02:48,530 --> 00:02:54,350 But in this reference, all the changes made inside that function to that value will be reflected. 34 00:02:54,560 --> 00:03:00,740 I would say the function then actual and formal arguments will be created in different memory location. 35 00:03:00,950 --> 00:03:05,000 That is the main example of the car value. 36 00:03:05,270 --> 00:03:11,960 And in case of car funds, actual and formal arguments will be rendered in same memory location, which 37 00:03:11,960 --> 00:03:14,750 means they will be working on the same mediums. 38 00:03:15,020 --> 00:03:17,210 So let's go to the next slide. 39 00:03:18,440 --> 00:03:21,980 This I have already explained global and local variables. 40 00:03:22,640 --> 00:03:28,730 So I have a variable in the program is not being say that function in that program. 41 00:03:29,330 --> 00:03:31,330 That variable is global variable. 42 00:03:31,610 --> 00:03:34,520 That variable can be accessed anywhere in the program. 43 00:03:35,000 --> 00:03:41,210 But if it variable variables created or declared inserted functionally, then that variable is called 44 00:03:41,210 --> 00:03:48,100 now variable, and that meaning will lie inside that function only after the function is ending. 45 00:03:48,320 --> 00:03:53,480 That variable will we believe that that concept I have already explained you in that beginning. 46 00:03:55,810 --> 00:04:01,750 So before moving on to Structure Park, let's move on to that covered by the forensics summary. 47 00:04:01,810 --> 00:04:02,410 We have. 48 00:04:03,960 --> 00:04:11,790 So here, let's take the first program car by value, this is that sadly be value, it's somebody here. 49 00:04:11,790 --> 00:04:14,730 We have actual arguments and for formal arguments. 50 00:04:14,940 --> 00:04:21,060 But what we're doing here, here we have number one and number two, but we are creating a copy of number 51 00:04:21,060 --> 00:04:24,270 one and number two and giving it that into the final shape. 52 00:04:24,540 --> 00:04:26,850 And that new copies resort called the. 53 00:04:27,420 --> 00:04:34,470 So number one and number two, not equal to anything because both are different memory locations. 54 00:04:34,680 --> 00:04:35,760 I'll be again in the Senate. 55 00:04:36,450 --> 00:04:47,100 So if I'm trying to print the value off and be after the statement here right away and I just need to 56 00:04:47,100 --> 00:04:49,080 make some adjustments to do this. 57 00:04:51,230 --> 00:04:57,890 So here I am declaring the function, I'm right up to that function and I'm trying to see out. 58 00:04:59,320 --> 00:05:01,290 A and B. 59 00:05:03,890 --> 00:05:04,910 I'm saving this. 60 00:05:06,460 --> 00:05:07,910 Let's see if this works. 61 00:05:08,080 --> 00:05:11,230 OK, so first off, what I am comparing the program. 62 00:05:12,780 --> 00:05:13,620 Plus comment. 63 00:05:15,160 --> 00:05:23,980 There is an error because it is not defined or undeclared, identified because it cannot understand 64 00:05:24,370 --> 00:05:29,230 because there is inside this function and be orally inside this function. 65 00:05:29,530 --> 00:05:33,310 Why does the function is entered here than we used last? 66 00:05:33,760 --> 00:05:37,350 So that's why we get our code and the order here. 67 00:05:37,360 --> 00:05:42,600 It's not even compiling, it's throwing it out because it cannot recognize any. 68 00:05:43,650 --> 00:05:49,600 If I am trying to come under the command and run this program again, then it will actually work fine. 69 00:05:49,650 --> 00:05:50,340 Let's see that. 70 00:05:51,030 --> 00:05:51,690 Yes. 71 00:05:53,340 --> 00:05:54,240 Oh, I did. 72 00:05:54,250 --> 00:05:54,630 And. 73 00:05:57,130 --> 00:05:59,110 OK, function definition is not away. 74 00:05:59,330 --> 00:06:03,250 OK, so we need to move down here. 75 00:06:10,220 --> 00:06:10,670 OK. 76 00:06:12,110 --> 00:06:14,420 So anyway, we will not be able to. 77 00:06:14,450 --> 00:06:16,010 No, we will not get another. 78 00:06:16,040 --> 00:06:16,610 Let's see. 79 00:06:17,210 --> 00:06:19,310 No, it's executing this fine. 80 00:06:19,670 --> 00:06:28,520 So anyway, here's what happened to there was number one and a different medium was only now more bad 81 00:06:28,520 --> 00:06:29,870 news for $3 here. 82 00:06:30,380 --> 00:06:36,380 And if I'm trying to change the value of this number one and I'm two, it will actually from here, 83 00:06:36,390 --> 00:06:37,220 it will not work. 84 00:06:37,390 --> 00:06:46,280 I don't like to change the value of I'm one and two from here because it's two different mediums and 85 00:06:46,280 --> 00:06:53,430 no one is not saying if I'm making the value of it something and I'm trying to pull out number one, 86 00:06:53,450 --> 00:06:56,030 it will not be saved because the end will not be fair. 87 00:06:56,690 --> 00:07:01,830 So to understand this more properly, I will explain to you, call by reference. 88 00:07:01,880 --> 00:07:06,050 So here again, see, our program goes back to values. 89 00:07:07,960 --> 00:07:16,390 Ideally, we should have it covered by value program and also, yeah, here we have a car by value program. 90 00:07:17,230 --> 00:07:20,020 So here I am, trying to stop doing how must have been. 91 00:07:20,020 --> 00:07:25,570 I must know what I do and I'm trying to slap the number between. 92 00:07:26,230 --> 00:07:27,300 So what? 93 00:07:27,340 --> 00:07:28,420 No start ask. 94 00:07:28,420 --> 00:07:33,190 No one should be number two and what the starting number one should be. 95 00:07:33,490 --> 00:07:34,060 Number two. 96 00:07:35,520 --> 00:07:42,000 OK, so then value and number two should be coming in, say no and no one should be coming in sick. 97 00:07:42,240 --> 00:07:49,860 Number two, yeah, I'm actually using car by value method, so I'm asking for the first number. 98 00:07:50,670 --> 00:07:53,490 Second number, then I'm calling this app function. 99 00:07:53,730 --> 00:07:56,490 WhatsApp function do it will accept you now. 100 00:07:56,490 --> 00:07:58,970 Must now want to do it, Williams said. 101 00:07:58,980 --> 00:08:04,520 There are no number three and it will first dial one of the numbers inside three. 102 00:08:04,710 --> 00:08:07,050 Then it will snap the other two numbers. 103 00:08:07,590 --> 00:08:08,670 That is a strapping. 104 00:08:09,420 --> 00:08:11,010 So what will actually happen? 105 00:08:11,490 --> 00:08:17,130 See, we can run this program and see what that is the best thing to do. 106 00:08:17,670 --> 00:08:24,510 So G Plus Plus card by value dark CBB. 107 00:08:26,080 --> 00:08:26,680 Yes. 108 00:08:27,760 --> 00:08:30,070 Then darts lashing out. 109 00:08:31,910 --> 00:08:33,470 And that of us, no doubt. 110 00:08:33,680 --> 00:08:35,410 And then the second number 15. 111 00:08:36,140 --> 00:08:41,890 So inside and outside function before shopping, the value number one restaurant and number two was 112 00:08:41,910 --> 00:08:42,360 15. 113 00:08:42,880 --> 00:08:51,200 Inside function app after dropping the value when it get inside the function, it becomes 15 and 12 114 00:08:51,650 --> 00:08:54,110 right by outside the function. 115 00:08:54,470 --> 00:08:55,880 It can come back again. 116 00:08:56,240 --> 00:09:00,950 I would say the function we are again printing number one and number two, what seat number one and 117 00:09:00,950 --> 00:09:02,000 number two are saying? 118 00:09:02,270 --> 00:09:09,410 Because the value which was here this morning and this number two are entirely different than new number 119 00:09:09,410 --> 00:09:16,250 one or number two because like outside in the previous zombies, we are only sending that copy off number 120 00:09:16,250 --> 00:09:17,150 one and number two. 121 00:09:17,330 --> 00:09:22,000 And this is an entirely new number one item to restore the call piece. 122 00:09:22,730 --> 00:09:23,120 OK. 123 00:09:23,240 --> 00:09:29,900 And this gobies are actually changing out here by this number and this number, you are not changing. 124 00:09:29,910 --> 00:09:32,580 That's why we are getting that same manual together. 125 00:09:33,830 --> 00:09:40,280 So suppose we are sending the car by a reference method, sending the values through common reference 126 00:09:40,280 --> 00:09:43,400 method, then we are not sending the values they are sending. 127 00:09:43,400 --> 00:09:44,240 There are tests. 128 00:09:45,810 --> 00:09:47,550 So let's see what happens there. 129 00:09:48,640 --> 00:09:50,470 So we have got about our friends. 130 00:09:51,810 --> 00:09:59,670 So, you know, so, yeah, statics and stowaway strap strapping or go static stories die. 131 00:10:00,090 --> 00:10:01,590 So that is stark. 132 00:10:02,040 --> 00:10:06,850 And here again, to see and see you again, see a sequel to 500. 133 00:10:06,930 --> 00:10:14,430 And while may nice wrapping, then I'm sending our prospects and our debts off way to that final mission, 134 00:10:14,430 --> 00:10:15,180 I have declared. 135 00:10:15,540 --> 00:10:17,370 So what happens inside the function? 136 00:10:17,760 --> 00:10:27,150 It will actually get done, get us off, extend right and start means the value inside that suffix straightaway 137 00:10:27,150 --> 00:10:30,300 means the value in say that off right now. 138 00:10:30,300 --> 00:10:33,840 What do we do after getting that value? 139 00:10:33,840 --> 00:10:37,140 In that particular memory, we have a strapping next Saturday. 140 00:10:37,180 --> 00:10:44,760 Values are exact locations in specific, not two different copies. 141 00:10:45,090 --> 00:10:53,220 That means this X and Y, and this X and Y are sadly us like acting on it. 142 00:10:53,490 --> 00:10:54,240 Same. 143 00:10:55,310 --> 00:10:59,180 Variable, I know you have some kind of confusion. 144 00:10:59,360 --> 00:11:01,340 So let's see this program in action. 145 00:11:03,740 --> 00:11:12,330 So again, C++ scarred by Rough Dog CPB. 146 00:11:14,190 --> 00:11:16,920 Now I'm going to head out out. 147 00:11:18,110 --> 00:11:24,900 Radyo face is heartland and values raised by see he had expressed by Hendrick and why he was under. 148 00:11:25,340 --> 00:11:27,710 So what happens if I'm printing it from here? 149 00:11:28,340 --> 00:11:30,170 Here it's inside the function. 150 00:11:30,350 --> 00:11:31,670 What happens if I'm printing? 151 00:11:32,030 --> 00:11:32,660 See out? 152 00:11:34,790 --> 00:11:35,450 Stop. 153 00:11:38,200 --> 00:11:39,250 Star Trek's. 154 00:11:41,780 --> 00:11:46,100 Star right now, I'm trying to. 155 00:11:48,730 --> 00:11:49,990 Ricky, the program. 156 00:11:51,820 --> 00:11:54,550 And I'm going to execute the program again. 157 00:11:55,650 --> 00:11:57,240 So it's fine, but I'm fine. 158 00:11:57,750 --> 00:12:07,800 Here again, I'll underline if I see that just because here the value changed and often even after exiting 159 00:12:07,800 --> 00:12:15,810 from this foundation, the value is also changed because this X and this right was the same. 160 00:12:16,810 --> 00:12:22,780 Variable, that's because you have that reference, not that you.