The goal of this video is to break apart some of what we wrote in the last video and to understand some more concepts.
The way a C program works is by writing out what we want the computer to do in very specific terms. Imagine that the computer is super dumb and you have to write down every single instruction.
Imagine you are a computer and I told you to like this video. Seems simple enough, right? WRONG! If you were a computer, I would have to really spell it out. I mean reaallllyyy spell it out. This means that to tell you to like his video the instructions might look something like
1. Move your hand to the mouse,
2. Grab the mouse,
3. Move the mouse until the cursor hovers over the like button on the screen,
4. Click the left mouse button.
The idea of explaining everything in detail is called an algorithm. This is an algorithm to like to my video. Now, I want to modify the algorithm a bit so that it can be used to like any video on my channel:
1. Move your hand to the mouse,
2. Grab the mouse,
3. Move the mouse until the cursor hovers over _________ (video).
4. Click the left mouse button.
5. Move the mouse until the cursor hovers over the like button on the screen,
6. Click the left mouse button.
Another thing to realize is that computers don’t remember have a memory quite like we do…. I mean they are really dumb. This means that to tell you to like another video, I have to repeat all of the instructions. This means that there are essentially 12 commands now. 6 for the first video, 6 for the second. What if we could just take all of these commands and extract them as one command? Well, we actually can. This is known as a function. Let’s create a function called likeVideo().
likeVideo(){
1. Move your hand to the mouse,
2. Grab the mouse,
3. Move the mouse until the cursor hovers over _________ (video).
4. Click the left mouse button.
5. Move the mouse until the cursor hovers over the like button on the screen,
6. Click the left mouse button.
}
Now, each time I want you to like a video, I can just say likeVideo(). This is called calling or executing the function.
What are the () for? That is where I tell you what video I want you to like. likeVideo(“C Programming Tutorial 10”), for example. This thing I’m passing in is known as an argument.
Now, what if I added to the function steps for you to look at how many people have liked the video and ask you to tell me. So I give you a request, and then you return a number to me. This is known as a function return.
Why am I telling you all of this? Well in C, we start every program with a function called main. When our program is run, the main function is executed.
In the next video we will be discussing more specifics about the code we wrote in the hello world program.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Support me! http://www.patreon.com/calebcurry
Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter
Donate!: http://bit.ly/DonateCTVM2.
~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~
More content: http://CalebCurry.com
Facebook: http://www.facebook.com/CalebTheVideoMaker
Google+: https://plus.google.com/+CalebTheVideoMaker2
Twitter: http://twitter.com/calebCurry
Amazing Web Hosting – http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Amazon Auto Links: No products found.
BEST TUTORIAL EVERRRRR!!!!!!!!!!!!!!!!!!!!!!!!! :0
You are awesome….every other tutorial makes you memorize functions but never explains what they really are !!!
104 likes! =p
You bro ! sub++; ! XD : ) ( i forgot all i knew about c! im learning it again and ur so awesome in teaching that ! your fast so the tutorial doesnt become boring . )
I found something awesome here!! I already knew all those stuffs but the way you taught was really impressive…I m subscribing
You’re adorable
Dude. You really are a good teacher.
Thanks Sir you give instructions really good…
<3 thank you so much for helping!
I have had a hard time on that learning curve, countless hours of reading and researching, but i am coming from C# so im slowly kinda sorta getting there.
One small disagreement, an algorithm doesn’t NEED to explain each step by step instruction, it can use high-level function calls that abstract over the implementation details. For example, in C, even with no library imports, a function that computes the factorial of a positive int n might be this:
int fact(int n){
if (n == 0 || n == 1) return 1;
else return n * fact(n-1);
}
but notice here that the mulitplocation operator * is a really just shorthand for a binary function like Mult(int a, int b), and few people expect a C programmer to efficiently define multiplication of integers from basic raw instructions!
can we use return to 1
1k
but your so fast in explaining
i like u rly like , come come i wanna kiss u , just coome
You’re such a great teacher
while (ongoing_series) {
printf(“thank you, Caleb!”);
}
return happy;
1:54 thank me later
RIP dear chalk we will miss you
971 likes
get your definitions right ! Algorithm : a word that a programmer uses when he doent want you to know what he did . : )
Plz give me the link for the best compiler for windows..
Learn Javascript – http://bit.ly/JavaScriptPlaylist
Learn Java – http://bit.ly/JavaPlaylist
Learn C# – http://bit.ly/CSharpTutorialsPlaylist
Learn C++ – http://bit.ly/CPlusPlusPlaylist
Learn C – http://bit.ly/CTutorialsPlaylist
algorithm.exe is unresponsive. server cant identify object “mouse”
nataka notes za c programming
great nice but what if we type return 1;
you somehow made a c language video explanation fun to watch!
The Orange house of gamers is hiring!
podey
Not for the sarcastically impaired. Like it.
Hi again, imo you should have mentioned the stdio header cause without it commands such as printf wouldn’t really have that output. But maybe you explain that later?!?!
Your explanations are simple but perfectly understandable, I’m just starting to watch your videos and compared to other tutorials out there, where people explain definitions in relatively complex ways, they have been way more helpful.
Right now, I already memorized the printf structure from the previous video. Wrote like 6 or 7 of them just to make sure that I got things correctly. I’ll be definitely looking forward to the rest, greetings from Uruguay!
You are currently saving my sanity. The education I am paying for has not been as easy to grasp as your videos. THANK YOU