

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 5
click for more info
Not enough gems
Cost: 6 gems
1: Welcome to Memory Management
incomplete
2: C Program Structure
incomplete
3: Interpreted Quiz
incomplete
4: C Is Compiled
incomplete
5: Comments
incomplete
6: Basic Types
incomplete
7: Strings
incomplete
8: Printing Variables
incomplete
9: Compilation: Types
incomplete
10: Variables
incomplete
11: Constants
incomplete
12: Functions
incomplete
13: Void
incomplete
14: Unit Tests
incomplete
15: Math Operators
incomplete
16: If Statements
incomplete
17: Logical Operators
incomplete
18: Ternary
incomplete
19: Type Sizes
incomplete
20: Sizeof
incomplete
21: For Loop
incomplete
22: While Loop
incomplete
23: Do While Loop
incomplete
24: Pragma Once and Header Guards
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Up to this point, we've been checking the standard output of your code against our expected output. Now that you're familiar with functions, most of the lessons will be graded using unit tests.
In particular, we'll be using the µnit (munit) testing framework. It's a simple, lightweight testing framework for C.
At Boot.dev, the Run button is for debugging. The Submit button mimics the idea of publishing your code for production use.
You should be debugging your code using the Run button. You should be adding printf() statements to your code to make sure it's doing what you think it's doing at different points in the code.
printf() the value you calculatedYou will never lose XP or be penalized on Boot.dev for using the run button. However, there are consequences for submitting broken code, just like there are career consequences for pushing broken code to your users!
Like how edge cases can creep up on you after shipping code to production, some test cases are only executed on
Submit
Take a look at the main.c file. You'll notice it's read-only: you can't change the tests (that would make it too easy to cheat- ha!). It #includes exercise.h at the top.
Open exercise.h and you'll see the function prototype (signature) of the function you need to write. In C:
.c files contain the implementation (c code)..h files are header files that contain the function prototypes.To import code from another file, you include the .h file.
exercise.c includes exercise.h.main.c includes exercise.h.This allows main.c to call the functions implemented in exercise.c.
Write the get_average (mathematical average) function in exercise.c based on the function prototype expected in exercise.h.
+ operator adds two numbers: 1 + 2 is 3./ operator divides two numbers, however: