You are looking at lesson 4. Your place is still lesson 12, task 1: malloc.
A breakpoint, the Debug window, the F7 and F8 steps, and how to look for a bug with the debugger.
When a program compiles but calculates wrongly, the compiler can't help any more. You could add a printf wherever you suspect the bug. Faster is the debugger: it stops the program where you want and shows the values of all the variables.
Click in the gutter next to a line number: a red dot appears, a breakpoint. Ctrl+F8 does the same.
Then start the program not with ▶ but with 🐞 Debug (Shift+F9). The program runs as usual until it reaches the breakpoint, and stops before that line. The line is highlighted: it hasn't run yet.
The Debug window opens at the bottom:
read_int, type the number here.| Button | Key | What it does |
|---|---|---|
| Step Over | F8 | runs the line and stops at the next one |
| Step Into | F7 | goes into the function the line calls (e.g. read_int → input.c) |
| Step Out | Shift+F8 | finishes the function and goes back to where it was called from |
| Resume | F9 | carries on to the next breakpoint |
| Stop | Ctrl+F2 | stops the program |
Most of the time F8 is enough: line by line, watching how Variables changes.
(double)sum / count. It is worked out again after every step.i == 3. The program stops only the third time round the loop.Optional. AddressSanitizer and UBSan work only on Linux, so in this course GitHub runs them. If you have WSL with Ubuntu and GCC, CLion can build the project there too: Settings → Build, Execution, Deployment → Toolchains → + → WSL, then in the CMake settings turn on the profile CI: ASan + UBSan (Linux) with that WSL toolchain. You then see sanitizer errors straight away, not only after a push.
Each one ticks itself when you do it.
All six done. You know your way around.
It is laid out like CLion: the same panels in the same places. This tour shows each one, and you can reopen it any time with Tour.
Switches the left panel: Lesson plan, Project files, Changes. Click the active icon again to hide the panel.
In CLion: the tool window bar runs down the left edge, too.
This part is not on this task: it appears when a task needs it.
Every task in this lesson. Now marks your place. Clicking a task only lets you look; it never moves your place. Project files and Changes open here too.
In CLion: this spot holds the Project view (the file tree).
This part is not on this task: it appears when a task needs it.
Opens the file for your task by itself. A tab appears for each file the step opens. The breadcrumbs above the code show the folder.
In CLion: the same editor tabs and breadcrumbs.
This part is not on this task: it appears when a task needs it.
Diff shows what changed, like git diff: red is the old code, green the new.
In CLion: the diff view in the Commit window looks the same.
This part is not on this task: it appears when a task needs it.
Terminal for build commands, Database to see your tables. They open by themselves when a task needs them. Drag the top edge to resize.
In CLion: Terminal, and the Database tool window.
This part is not on this task: it appears when a task needs it.
What to do now, right above the code, so you never miss it. Numbered notes in the code explain the important lines. Details shows what you should see and a hint.
In CLion: no equivalent: this is your lecturer's guide.
This part is not on this task: it appears when a task needs it.
Done is the only button that moves you forward. Look back lets you review without losing your place.
This part is not on this task: it appears when a task needs it.
Guided, Focus code or Floating. You can drag the panel edges too. Your layout is remembered for next time.
In CLion: you can also rearrange and hide tool windows.
This part is not on this task: it appears when a task needs it.
Six small missions. Each one ticks itself when you do it, so you know you have found everything.