0:00 What's going on guys? This is Bucky. Welcome to your sixth c plus plus tutorial. 0:04 And in this tutorial, I wanna go over some concepts with variables that are 0:08 definitely going to help you later on. 0:09 So, the first thing I wanna go over is this. You remember last 0:13 tutorial, I told you guys at they're basically two different ways to create 0:17 variables? 0:17 The first way is to create a variable called "tuna" or something 0:20 and set it equal to the value like 43 all on one line. 0:24 Simple enough, easy to understand. Well, what I also told you guys you can do is 0:29 you can declare aka "create it" on one line 0:32 and set it to a value on other line such as that. 0:36 They're both perfectly acceptable ways to do things. 0:39 The one thing I want to stress is that whenever you do it this way, 0:44 declare on one line and set equal to the value on another line, 0:47 you don't need to write what type variable it is, again. 0:51 Once you give c plus plus the information up what type of data you're 0:55 working with 0:56 you don't need to list it every time you're working with variable. C Plus Plus will 1:00 remember that information. 1:01 Aand 1:02 You know, it will keep it. So, whenever you're working with "tuna" later on 1:06 you don't need to explicitly write "int", and actually you can't, or else it will give you an error message. 1:11 So, just make sure that now just remember that don't write "int" twice 1:15 on the same variable. So, aside from that, let me show you guys this. 1:20 int tuna equals 99. So, later on 1:24 and I didn't tell you guys this, but what you can do 1:27 is if you set tuna to something else like 1:30 76, whenever your computer creates a variable 1:35 it sets aside a piece a memory to store that value. In this case 99. 1:39 Well whenever you create, or excuse me, whenever you use that variable. 1:44 again and set it equal to a new value what your computer is going to do is it is gonna 1:48 wipe out the old value, 1:49 in order to make a room for the new value. So now you said alright, 1:53 we have a variable called "tuna" and that's equal to 99. 1:57 well now, we have a variable called tuna 2:00 and we want that set the sick with 76. Well alright. 2:04 So, we're going to try to print out tuna in our computers gonna say alright. 2:08 Should I print out 99 or 76? Well, since we created one originally 2:13 that was 99 and then we overrode it to make it 2:17 76 is gonna print out 76. So, let's go ahead and build and run this. 2:21 And see what you get? 76! So, basically 2:25 whenever you have a value it's placed in a memory 2:28 location and then whenever you get that variable 2:31 a new value its gonna overwrite the old value 2:34 and put it in the same location. So, I just want tell you guys that 2:38 this is how you can overwrite variables, so if you're expecting 99 and you got 76, 2:44 this is why. So, that's actually all I have for you guys as for this tutorial. 2:47 Again, the two things I wanna stress is, whenever you're creating a variable 2:52 you only write the type once! 2:55 You don't need to write it every single time. And then whenever you need to reassign 2:59 value 3:00 just go ahead right variable name and not the type again. And also 3:04 whenever you're over writing a variable, you use the variable and its can be equal to 3:09 the latest 3:10 value. So, whenever you, you know, set this equal to 76 3:14 is going to wipe out the 99 and use the 76. 3:17 I just want to stress those, a couple memory concepts. Then 3:21 whenever building programs later on you might have a better understanding of 3:24 how it works. 3:25 So, for now that's all I have for you guys and the next tutorial. 3:29 You know how I said that we're going to be going over arithmetic, like, 3:32 how to add two numbers together well there's actually a bunch of different 3:36 arithmetic operators that we need to learn and that's we're going to be covering in 3:40 the next tutorial. 3:40 But for now, thank you guys for watching. Don't forget to subscribe and I will see you next video.