x++ increments the value of variable x after processing the current statement. ++x increments the value of variable x before processing the current statement.
@jakethesnek144311 жыл бұрын
Bucky is my hero. I'm 2 Weeks into my intro to C++ class and I've already learned everything we will cover in 10 weeks.
@Remychels10 жыл бұрын
Bucky you rock! Best C++ teacher yet.
@arandomboredindividual78553 жыл бұрын
still the best c++ tutorial on youtube and its 2021
@ValdiBald10 жыл бұрын
Awesome tutorials Bucky! One point, "++" is a function with a return. So when you do x++ your calling a function that increments x but the "post++ function" is designed to return the old value in case you need it (in most cases you don't). If you do the "++pre function" your calling another function that also increments but returns the new value. That's why your getting 20 because your not asking for x, your asking for the return of the function. It does increment before the end of the line and you can see that e.g. if you do: cout
@UncannyAura10 жыл бұрын
...It helps and simple...I suppose but it's too long an explanation, its irritating. Doing x++ is like telling the computer to increment the value of x after the line of code. Doing ++x is telling the computer to increment the value of x before the line of code. The End.
@ValdiBald10 жыл бұрын
Uncanny Aura Your right, its way too long. One thing, in both cases it increments x before the line ends. That's my over complicated point. What I'm trying to say is that the new value of x and the return of the ++ function are two totally different things. Hope it helps :)
@UncannyAura10 жыл бұрын
ValdiBald Ok, much better :)
@SlightlyNerdyGaming11 жыл бұрын
Finally, Bucky taught me something that the comments taught me 3 videos ago. (Talking about the '+=' thing.)
@ShadowTetsuo999911 жыл бұрын
im actually glad i came across your comment,lol I am trying to learn C++ and i was about to wait until i got to lesson 30 then spend about a week reading the book then come back and see if i grasp more of what Bucky is teaching, so far i love these tutorials, he explains very well
@umarbekinalkar23143 жыл бұрын
still best c++ tutorial in 2021
@srijal10 жыл бұрын
No of viewers decreases as we progress to each tutorial.
nah they are straight up Boring::Lazy(time, age, intelligence, motivation)
@zapxcero7 жыл бұрын
r/iamverysmart
@arandomdude17417 жыл бұрын
It decreases because people just give up to continue.
@ankursingh82966 жыл бұрын
True. agree with it
@reziyemusulaiman93233 жыл бұрын
omg, this guy literally teaches everything in so simple and clear way, thanks bucky
@unison197810 жыл бұрын
these are the details that matter when learning programming... Brilliant!
@_sideways_63215 жыл бұрын
You teach way better than my lecturer THANK YOU FOR EXISTING
@voidarts11766 жыл бұрын
Bucky, you will always be a double plus in my books!
@JohnMcclaned12 жыл бұрын
I have watched all these videos in like a day, with no previous experience and understand basically all of it. I guess it just comes down to practicing what I have learned and experimenting different things :) GET EXCITED! One step closer to world domination
@NeilRoy10 жыл бұрын
Actually, C++ will follow the line and execute each statement as it goes. ++ is actually a command that would get interpreted as a machine language instruction like INC (increment). So if you read through the line again... you may understand why it prints out the unincremented value first with x++. This is what the compiler sees... cout
@RedsBoneStuff9 жыл бұрын
4:14 Prints "21" twice. _And_ this is episode 21. _And_ 21 is my favourite number. What are the chances ...
@bocbinsgames67459 жыл бұрын
RedsBoneStuff hate to say it but the program is not using any random operators so the chances were 100% that it would be printed. sorry if i ruined your miracle.
@RedsBoneStuff9 жыл бұрын
TeamGBplaysminecraft Yes, I know all of that ... but Bucky chose 20 "randomly" because any number would be fine. He did not, however, know that 21 is my favourite number. And I'm pretty sure he didn't intentionaly link this with the number of the episode.
@bocbinsgames67459 жыл бұрын
ok true
@PS2Damon9 жыл бұрын
RedsBoneStuff he didn't pick 20 randomly, he said that it was his favorite number..
@mishoaleksidze78209 жыл бұрын
+RedsBoneStuff So, do you think you're special?
@SebSharma7 жыл бұрын
Sorry guys, I had too #include using namespace std; int main() { int a = 1; int num = 0; while(a==1){ cout
@blade5555512 жыл бұрын
Agreed. When I was younger about 6 years ago or so (about 13-14) I tried to teach myself C++ and didn't really understand it. I am now 20 and I am understanding this unlike my younger self. Kinda crazy because I just wanted to jump straight into game programming which now that I know how it works a bit more, is a long way off ^^.
@dave369_ Жыл бұрын
Great explanation of pre and post increment operators 👍👍🙂🙂
@michaelC258513 жыл бұрын
@iYateszy no. it must be after to tell the comp. that it needs to increment by one. you could do that if you had a variable called '++x'
@toringedotno13 жыл бұрын
@Regginyaga It because of UNIX systsems, 0 means the program quitted without errors. Numbers above 0 have their own error code.
@Skulltroxx5 жыл бұрын
3:14 lmao i died XD //notice the timestamp (pie)
@vagabon51306 жыл бұрын
wow your very clear in your speaking. thx much.
@blade5555512 жыл бұрын
lol I didn't even think about that. I just now noticed how much it dropped from the first couple xD.
@ryndm9 жыл бұрын
Your amazing ur videos help me a lot
@arthureru11 жыл бұрын
x++ uses the old value in the statement that it was used after the statement it increments ++x increments the variable before running the statement cout
@buddyd28418 жыл бұрын
The
@loading_wait10 жыл бұрын
was it only me who giggled every time he said "twenny won"
@murphydublin9 жыл бұрын
Thank you brother, your so genius.
@Elcosmicstar16 жыл бұрын
Hi Bucky, thank you for tutorials. I accidentally noticed while doing a lesson that if I leave out "int" at the beginning of "main" the program will still run, so I tried it with a few others and it stilled worked. I also observed that if I replaced "int" with "void" or any others, I would get the error message "main must return int". I guess, because main must return an int, it is also not necessary to declare it. "pretty cool huh".
@josephlong1699 жыл бұрын
I made the mistake attempting to go though your Java tutorials before coming here...
@youngGenzombie11 жыл бұрын
That comment actually makes me feel good about myself :D
@sounakghosh88743 жыл бұрын
i remember this part.. another tutorial used like 21 minutes to explain this simple thing
@herp_derpingson12 жыл бұрын
Dont question my persistence! I went through all the 200 android tutorial videos :D
@thered_hood74518 жыл бұрын
best tutor ever
@NickSecourity10 жыл бұрын
You are a very good teacher :D....
@bryanswaggbeast81948 жыл бұрын
so i believe C++ stands for #1 coding language i guess!?
@TraceursMonkey6 жыл бұрын
Finally , someone who dose not haw an accent
@masterhadi7711 жыл бұрын
ok but i dont get this; you already defined the variable x as 20. so cout
@Telseilong13 жыл бұрын
i still would put return 0; looks like codeblocks holding your hand, which is good but other compilers could give you a WTF a int function not returning a int.
Why does bucky not have any new videos or posts on any of his social media?
@Direwolf5611 жыл бұрын
It's not programming itself, its the programs you create.
@xXLanyuzAnlunXx9 жыл бұрын
can you do ++x++ :)
@xXLanyuzAnlunXx9 жыл бұрын
oh lol
@steve1222888 жыл бұрын
+Phloat Wireless yeah it gives me an error when i try that.. is there actually a way to do it? maybe its the standard that is preventing me in some relation to what peterolen was saying
@steve1222888 жыл бұрын
error: 1value required as increment operand. That is what it tells me no matter where i place it. Good thing I would never have to do such a thing anyway haha.
@joeygylytiuk33765 жыл бұрын
well technically that'd be the same as incrementing "x" by 2, right? so same as{ cout
@Capn-Coin8 жыл бұрын
Anyone have any idea why my program takes long to build and run?? its not the code because i've tried running just a hello world program... its starting to annoy me because it takes about 5 - 10 seconds to build and run each time I want to check my code...
@Capn-Coin8 жыл бұрын
+Peterolen yeah it was. thanks :)
@SamanGivian8 жыл бұрын
that happens to my visual studio too
@Stavros33GR13 жыл бұрын
is still your favorite number 20???
@umaribnali213811 жыл бұрын
Thanks a lot man! A big (Y).
@steve1222888 жыл бұрын
if you can do "cout
@steve1222888 жыл бұрын
interesting. I thought ++ was a shortcut for +=1 though so i would not imagine it to have higher precedence. It is still slightly strange that 20+x results in 30 where ++x is some kind of special operator to.. add a number to x? .. but it intentionally has a higher precedence? Well, i think the designer of c++ is playing a role here. Also i find it very funny that you can type 30; as one line haha. never knew this was ok it makes me rethink how a programming language works.
@steve1222888 жыл бұрын
also I noticed in java it does not obey precedence with ehm math operands? I mean like 18 + 2 * 2 = 40 in java and other languages but in c++ it is like real math where 18 + 2 * 2 = 22 . I guess java doesnt have the
@Ukid1119 жыл бұрын
Can you use modulus (%=) for an increment operator?
@Ukid1119 жыл бұрын
+Peterolen Ty
@asian_delirium9 жыл бұрын
I am totally new to this language and i have a weird problem here:just testing around when i find out that when i try this simple code: #include using namespace std;int main() { int x = 11; while(x>=0) { cout
@kuraigu129 жыл бұрын
+zzZMrWangZzz Save the project and relaunch the Code::Blocks. I've encountered these problems many times before I switched to Visual Studio.
@huskie52799 жыл бұрын
Thanks Bucky!
@SamGulz11 жыл бұрын
Proud of myself for d first time
@gabriellelopez-herrera8205 жыл бұрын
You are awesome!
@Erox00612 жыл бұрын
how many favorite numbers do u have bucky ??
@baddmanaz10 жыл бұрын
thanks, OBOEma!
@TheJavaScriptKid12 жыл бұрын
if you understand Advanced Javascript You Can Understand C++
@luksports55511 жыл бұрын
Wait, is there (varible)** or **(varible)?
@That0n3Gam3r11 жыл бұрын
if the endl at the end of cout doesnt work for you then do this cout
@LurkrulDoesThings11 жыл бұрын
did you not watch the last video? I think you should go back and watch it again if you didnt see the math.
@TheCosmicChicken12 жыл бұрын
Just breathe, Bucky, breathe.
@digitalhustler0510 жыл бұрын
thank you bucky too
@FrankLopezx9 жыл бұрын
WHAT TYPE OF ANSWER WILL I END UP WITH? will it say 2 3 4? i#include using namespace std; int main() { int B = 2; cout
@FrankLopezx9 жыл бұрын
any body can say that, but no one is going to give me the actual why breakdown
@FrankLopezx9 жыл бұрын
why 4,4? if i go with that notion i wud say 3-4
@FrankLopezx9 жыл бұрын
Jordan Filipovski those parameter can be change in cpp?
@FrankLopezx9 жыл бұрын
oh right yes i forgot my own example lol ur right
@angeldominguez112 жыл бұрын
we also dont need the system("pause"); anymore uh
@tutorialvalley48906 жыл бұрын
its really true that a school degree is useless :) thank go i am only 12 so i dont have to boder about that
@johnflatt6659 жыл бұрын
No sound on this or sololearn.
@markanthonybulaon411312 жыл бұрын
aklncasc: Buck Rules... \m/ you Buck my World \m/
@keepingalowprofile12 жыл бұрын
%= is pretty mind blow
@ClaudiuB7 жыл бұрын
"I'm 14 and cthuluhuh" "You're better than my teacher! f.him!" "did I spell anything wrong, yes who cares?42" ++++++++++++++++++++++++++++++
@mrAspDotNet11 жыл бұрын
GJ!
@kems15925 жыл бұрын
Whats the use of this?
@taylorsamy12 жыл бұрын
at this rate by the end it will just be my you and @supersush269
@supbrotv12 жыл бұрын
WATERMELON!!
@joetomaselli808411 жыл бұрын
Are you trying to correct the amount of views? I mean, if so, then I don't think you understand how things change in time...
@mathewseldo577411 жыл бұрын
bucky ur vids r cool
@sherifnegm904611 жыл бұрын
good job
@GBJaayy4 жыл бұрын
Me watching this video in 2021 and that was the first ouput of the program (20 , 21 ) 😂😂
@nate972112 жыл бұрын
I've heard that programming has to do a lot with math I still haven't seen the math side of it
@jeremyride18 жыл бұрын
anybody know a good free c++ builder program?
@deadspeakers8 жыл бұрын
Visual Studio
@thavrisco16328 жыл бұрын
I like code::blocks.
@rohankhanna87538 жыл бұрын
can we start java without c++ ?
@Tylernal8 жыл бұрын
Yes, C++ is more difficult and more useful than Java though.
@rohankhanna87538 жыл бұрын
i dont think so lol java is more useful than C++
@Tylernal8 жыл бұрын
Rohan Khanna It depends what you want to make. For game design, C++ is better.
@rohankhanna87538 жыл бұрын
and what java is good for can u plz tell me !!
@Tylernal8 жыл бұрын
Rohan Khanna Android apps
@Tulanir112 жыл бұрын
I never said 3D games :) i'm gonna start with 2D games
@ajwayman45306 жыл бұрын
twenty one... uh... twenty one
@nate972112 жыл бұрын
Except for variables maybe
@Tulanir112 жыл бұрын
Only 52 videos until i can start making games :D :/
@malteeaser1019 жыл бұрын
'x = x + 10' is the same as 'x += 10'? Wow, now I can type one less character!
@brandonjohnson24916 жыл бұрын
And you will be typing even less characters when the variable is longer than one character. Also, don't forget to count your spaces, they are typed characters as well.
@TheDarksiderrr12 жыл бұрын
That's just what he said ;)
@herp_derpingson12 жыл бұрын
Tell me more that you are the CEO of some international corporation.
@NDZ1234513 жыл бұрын
good video
@SamGulz11 жыл бұрын
4 more in an year's time :P
@nioway219811 жыл бұрын
Hey guys does anyone think this is like way too easy?
@gopinath27K11 жыл бұрын
21st c++ video has 43144 views now
@poseidenjp149612 жыл бұрын
whats that ? :D
@alexandertouma55886 жыл бұрын
x=20; z; z=x++ + x++; what is the answer?
@Hairyson-g5j6 жыл бұрын
Alexander Touma: my answer is 41. So I guess for the first one you will get 20, and right after the first one x becomes 21, so for the second one you get 21, and z = 41, x= 22
@alexandertouma55886 жыл бұрын
@@Hairyson-g5j thank you, fellow Asian.
@supTE6 жыл бұрын
Nice
@ishaanpunetha3 жыл бұрын
Okay thanks
@ShadowTetsuo999911 жыл бұрын
seems you have a good summer break lol jkjk
@avnisharma490210 жыл бұрын
thanks
@glenngroveau180710 жыл бұрын
5 Tutorial Jul kkk99.oo
@ThePyrotechx13 жыл бұрын
1 person has shaky hands.
@psyckojoe12 жыл бұрын
Considering the first video was how to install a program with an installer, I'd say most people who watched the first video are either stupid or incredibly impatient.