You are looking at lesson 10. Your place is still lesson 4, task 1: Style.
struct and typedef, initial values in member order and with names, the dot, size with alignment, = copies, == doesn't exist.
In the gradebook a student has so far been several separate variables: name, grades, count. They belong together, but the language doesn't know that. A structure joins them into one type.
typedef struct {
char name[20];
int population;
double area;
} City;
struct { ... } describes a new type made of several members, each with its own type and name.typedef ... City; gives the type a short name: from then on you write City kaunas;, like int x;.City, Student), so it doesn't look like a variable.}.City kaunas = {"Kaunas", 300000, 157.0};
City vilnius = {.name = "Vilnius", .population = 600000, .area = 401.0};
printf("%s: %d\n", kaunas.name, kaunas.population);
kaunas.population += 1000;
.population = ...): that reads more clearly and the order doesn't matter. Members left out become 0.kaunas.population. It's an ordinary variable: you can read it, change it, pass it.= an array member (topic 9): snprintf(kaunas.name, sizeof kaunas.name, ...).The members sit one after another, in the order they were written:
The compiler may insert padding so that an int or a double starts at a suitable address – the processor reads them faster that way. So a structure's size can be bigger than the sum of its members, and you always find it with sizeof rather than counting it yourself.
City copy = kaunas;
= copies the whole structure, array members included. Changing copy.population leaves kaunas unchanged.
Two structures can't be compared with ==:
error: invalid operands to binary == (have 'City' and 'City')
Compare the members: strcmp(a.name, b.name) == 0 && a.population == b.population.
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.