You are looking at lesson 2. Your place is still lesson 5, task 1: Functions.
Extra: practice/02/main.c in assembly. Hover over a C line and see where the variables live in memory and what the compiler worked out by itself.
Extra. This step is not graded and the homework doesn't need it. It is a look at what the compiler makes of your program.
The processor doesn't understand C. GCC turns your main.c into machine code: simple commands such as "move a number", "add", "compare", "call a function". The text form of those commands is called assembly.
Open the tool window's Assembly tab. On the left is practice/02/main.c, on the right what GCC made of it: for an x86-64 processor, Windows, as MinGW does in CLion. Hover over a C line and its instructions light up, and the other way round. Click to keep the selection (Esc clears it).
Reading an instruction: first the command, then where it writes, then where from it takes. mov eax, 5 means "put 5 into eax". eax, edx, rcx… are registers: the processor's dozen or so "variables" it computes with.
rbp: mov DWORD PTR -8[rbp], 1 is int study_year = 1;. DWORD is 4 bytes, the size of an int.char group = 'A'; becomes BYTE PTR and the number 65: a character is just a number.sizeof computes nothing while the program runs: the 4, 8 and 1 sit ready next to printf.100LL * 365 * 24 * 60 * 60: the compiler did it itself and wrote the result.rcx, the second in rdx, the third in r8, the fourth in r9 (the Windows rule). The result comes back in eax, which is how read_int's answer gets into the variable.Switch to -O1: most variables move from memory into registers, and study_year disappears altogether: printf simply gets 1.
The debugger shows machine code too: stop at a breakpoint, right-click a line in the Debug window's Frames list and choose Disassemble. For Intel syntax, as here, type set disassembly-flavor intel in the Debug window's GDB tab first: topic 5 shows it step by step. CLion's GCC (11.2) is a different version from the one that generated this view, so some instructions may differ slightly.
C source main.c
x86-64 assembly -O0
x86-64 assembly -O1
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.