Key Concepts

Review core concepts you need to learn to master this subject

Functions: Lesson
Lesson 1 of 1
  1. 1
    As you continue to write more code there will be times when you’ll need to reuse a set of instructions. You might be tempted to reuse the code by copying and pasting it, but in times like this, a _…
  2. 2
    As we’ve seen, the code printf(“Hello, World\n”) outputs the string between the parentheses to the console. The general usage of a function is to “call” the given name with a set of parentheses. An…
  3. 3
    Now that we know how to call functions, use their arguments and capture their return values, let’s take a look at some functions provided by the C programming language. C gives us access to many u…
  4. 4
    We’ve seen how C comes with many handy libraries full of functions for us to use. Now let’s learn how to make our own! To begin, we need a function signature. The function signature tells us 3 thi…
  5. 5
    We now know how to define a function, so let’s look closer at function return values. Calling a function to do some work and return a value is a common use of functions. It is important to understa…
  6. 6
    In the last exercise, we created a function random1000() that returned a random number between 1 and 1000. What if we wanted the upper bound to be 10000 or 1000000? We could define new functions li…
  7. 7
    We’ve made great progress so far with functions! Up to this point when a function has received an argument, the function makes a copy of the argument’s value and stores it in the parameter variab…
  8. 8
    So far when we’ve called a function, we had to make sure that it is declared above the line in our code from where we are calling it. If not, the compiler will have not stored the function signatur…
  9. 9
    Great job learning about functions! We’ve managed to cover many important topics like: - Functions are a named set of instructions - Functions can take in a set of inputs and produce some output -…

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo