C Programming Tutorial 4 – How a C Program Works – Part 1

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().
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!)


NurIhsan AlGhifari says:

BEST TUTORIAL EVERRRRR!!!!!!!!!!!!!!!!!!!!!!!!! :0

Mohamed Wael says:

You are awesome….every other tutorial makes you memorize functions but never explains what they really are !!!

Brofin says:

104 likes! =p

Codingmaster says:

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 . )

satyata dhargawe says:

I found something awesome here!! I already knew all those stuffs but the way you taught was really impressive…I m subscribing

Joy L says:

You’re adorable

treboomboom says:

Dude. You really are a good teacher.

Men On A Mission with JAMES ADAMS says:

Thanks Sir you give instructions really good…

Crazed Programmer says:

<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.

Gregory Fenn says:

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!

Vimukthi Aravinda says:

can we use return to 1

Oudom Samnang says:


vicent mathias says:

but your so fast in explaining

GoldenSwoord says:

i like u rly like , come come i wanna kiss u , just coome

Soraya Goga says:

You’re such a great teacher

FreeMan37 says:

while (ongoing_series) {
printf(“thank you, Caleb!”);
return happy;

Nabeegh Ahmed says:

1:54 thank me later

Zerbberuss Setzu says:

RIP dear chalk we will miss you

Joshua Jones says:


Codingmaster says:

get your definitions right ! Algorithm : a word that a programmer uses when he doent want you to know what he did . : )

Durgesh Kumar says:

Plz give me the link for the best compiler for windows..

Dan The Trombone Man says:

algorithm.exe is unresponsive. server cant identify object “mouse”

vicent mathias says:

nataka notes za c programming

Alo_ImpeRatOr Mero says:

great nice but what if we type return 1;

17jflor says:

you somehow made a c language video explanation fun to watch!

Brett Sullivan says:

The Orange house of gamers is hiring!

Akhil P S says:


hightttech says:

Not for the sarcastically impaired. Like it.

Julio Oliveira says:

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?!?!

Lunos says:

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!

Jared Neaves says:

You are currently saving my sanity. The education I am paying for has not been as easy to grasp as your videos. THANK YOU

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!