• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Caleb Curry

Making Money and Investing

  • Home
  • Make Money Online
  • How to Buy Bitcoin
  • Get Started with Real Estate Investing
  • How to Start a Website
  • Courses
    • Full Time Income Online
  • Sponsorship

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

October 17, 2018 by Caleb Curry Leave a Comment

Don’t forget to read the last blog on writing our first program! New here? Start from the beginning! 

The goal of this blog is to break apart some of what we wrote in the last blog and to understand some more concepts.

How Does a C Program Work?

First of all, 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 share this blog. It seems simple enough, right? WRONG! If you were a computer, I would have to really spell it out. I mean reaallllyyy spell it out! Because of this, to tell you to share this blog, the instructions might look something like

The idea of explaining everything in detail is called an algorithm. This is an algorithm to share my blog post. I want to modify the algorithm a bit so that it can be used to share any blog on my website:

Computers are Dumb

Computers don’t have a memory quite like we do…. I mean they are really dumb. As a result, to tell you to share another blog, I have to repeat all of the instructions.

There are 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 shareBlog().

Now, each time I want you to share a blog, I can just say shareBlog(). This is called calling or executing the function.

What are the () for? That is where I tell you what blog I want you to share. shareBlog(“C Programming Tutorial 10”), for example. This thing I’m passing in is known as an argument.

What if I added to the function steps for you to look at how many people have shared the blog and ask you to tell me? When I give you a request, you then return a number to me. This is known as a function return.

Conclusion

Finally, why am I telling you all of this? Because in C, we start every program with a function called main. For this reason, 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.

Do you enjoy these blogs? Check out the next one!

Filed Under: Uncategorized Tagged With: c programming, how a c program works

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

my face to show my face

My name is Caleb Curry and I started my online business teaching software development and doing digital marketing for brands. Entrepreneurship has changed my life and has allowed me to earn a full time living from anywhere. I now have the freedom and energy to pursue skills and opportunities that I find interesting. This website is all about my journey.

Get my top Python Tips and Tricks

50+ Python Tips and Tricks!

Subscribe to our newsletter to get notes and latest content by email.

    We won't send you spam. Unsubscribe at any time.

    Follow Me!

    • Instagram
    • YouTube

    Recent Posts

    Copyright © 2021 · Genesis Sample on Genesis Framework · WordPress · Log in