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: