<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>C on Rebel Zhang&#39;s Blog</title>
        <link>https://rebel1725.codeberg.page/blog/en/tags/c/</link>
        <description>Recent content in C on Rebel Zhang&#39;s Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en-GB</language>
        <managingEditor>rebel1725@tilde.club (Rebel Zhang)</managingEditor>
        <webMaster>rebel1725@tilde.club (Rebel Zhang)</webMaster>
        <lastBuildDate>Wed, 11 Nov 2026 18:02:19 +0800</lastBuildDate><atom:link href="https://rebel1725.codeberg.page/blog/en/tags/c/index.xml" rel="self" type="application/rss+xml" /><item>
            <title>From Knowing C Syntax to Becoming a Real C Programmer</title>
            <link>https://rebel1725.codeberg.page/blog/en/post/from-knowing-c-syntax-to-becoming-a-real-c-programmer/</link>
            <pubDate>Wed, 11 Nov 2026 18:02:19 +0800</pubDate><author>rebel1725@tilde.club (Rebel Zhang)</author>
            <guid>https://rebel1725.codeberg.page/blog/en/post/from-knowing-c-syntax-to-becoming-a-real-c-programmer/</guid>
            <description>&lt;p&gt;C is a really easy-to-learn programming language. Variables, functions, control-flow statements, structures, pointers, and that&amp;rsquo;s about it. Most importantly, C gives you control: when you write code in C, you are the god.&lt;/p&gt;&#xA;&lt;p&gt;However, with great power comes great responsibility. You can make everything work perfectly and efficiently, but you can also mess everything up by introducing stack overflows, dangling pointers, use-after-free errors, null-pointer dereferences, double-free errors, memory leaks, out-of-bounds memory accesses, and so on into your programme.&lt;/p&gt;&#xA;&lt;p&gt;Furthermore, C is a powerful language that gives you control. However, this also means that C offers much less abstraction than C++, Python, and other languages, and you are responsible for implementing much of the logic needed to get things done. Therefore, &lt;strong&gt;there is a huge gap between knowing C syntax and becoming a real C programmer.&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;I learnt C in 2024/2025, but without putting my knowledge into practice by writing real, production-ready programmes, I moved on to learning C++. I then started writing applications in C++ and Qt, which I found comfortable. However, in recent days, I have been hitting roadblocks while trying to implement a CanoKey companion application with &lt;code&gt;libcanokey&lt;/code&gt;. Its initial purpose was to practise C++ + Qt + Kirigami programming, but I have realised that I still have a lot to learn to move from &amp;lsquo;knowing C&amp;rsquo; to &amp;lsquo;knowing how to develop useful programmes in C&amp;rsquo;.&lt;/p&gt;&#xA;&lt;p&gt;This article lists some simple examples, and I hope it helps other people who have just learnt C syntax but do not yet know how to write useful programmes in C.&lt;/p&gt;&#xA;&lt;h2 id=&#34;object-oriented-programming-in-c&#34;&gt;Object-oriented programming in C&#xA;&lt;/h2&gt;&lt;p&gt;C does not natively support OOP. One of its main built-in aggregate types for grouping values is called a &lt;em&gt;structure&lt;/em&gt;. It combines several members of C&amp;rsquo;s built-in types or other structure types into a single type, with possible padding between members. However, many projects and libraries from the free software community that are written in C use a manually implemented, pseudo-OOP design. They do not extend C syntax; they simply use structures to achieve what they want.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-basic-idea&#34;&gt;The basic idea&#xA;&lt;/h3&gt;&lt;p&gt;Define a structure:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; Counter&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; a;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} Counter;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And define some functions:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;counter_create&lt;/span&gt;()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;ans &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;malloc&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;ans);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt; ans) &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; NULL;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ans&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; ans;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;counter_increase&lt;/span&gt;(Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;self)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    self&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;counter_get_value&lt;/span&gt;(Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;self)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; self&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Congratulations! You have implemented a class and its methods in C.&lt;/p&gt;&#xA;&lt;p&gt;A C++ class that does the same thing would look like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;Counter&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;public&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Counter()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; a(&lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;) {}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;increase&lt;/span&gt;()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;get_value&lt;/span&gt;() &lt;span style=&#34;color:#66d9ef&#34;&gt;const&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;this&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;private&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; a;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The core idea is to &lt;strong&gt;use structures as objects and functions as methods&lt;/strong&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;encapsulation&#34;&gt;Encapsulation&#xA;&lt;/h3&gt;&lt;p&gt;We usually treat the structures we define as objects and operate on them using a set of functions. However, directly modifying the members of these structures is still possible, which can produce unexpected behaviour.&lt;/p&gt;&#xA;&lt;p&gt;C does not provide a mechanism for preventing a structure from being modified directly while still allowing it to be modified through a given set of functions. However, there is a trick that can help us achieve our goal.&lt;/p&gt;&#xA;&lt;p&gt;Put the declarations of our structure and functions inside a header file, &lt;code&gt;counter.h&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#ifndef COUNTER_H&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#define COUNTER_H&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; Counter Counter;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;counter_create&lt;/span&gt;();&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;counter_increase&lt;/span&gt;(Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;self);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;counter_get_value&lt;/span&gt;(Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;self);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#endif&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And put the implementations inside &lt;code&gt;counter.c&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;counter.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; Counter&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; a;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;};&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;&lt;span style=&#34;color:#a6e22e&#34;&gt;counter_create&lt;/span&gt;()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;ans &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;malloc&lt;/span&gt;(&lt;span style=&#34;color:#66d9ef&#34;&gt;sizeof&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;ans);&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; (&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt; ans) &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; NULL;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ans&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;0&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; ans;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;counter_increase&lt;/span&gt;(Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;self)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    self&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a&lt;span style=&#34;color:#f92672&#34;&gt;++&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;counter_get_value&lt;/span&gt;(Counter &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;self)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;return&lt;/span&gt; self&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;a;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In any source file that needs to use &lt;code&gt;Counter&lt;/code&gt;, simply write:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#include&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;&amp;#34;counter.h&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, your source file knows that there is a structure called &lt;code&gt;Counter&lt;/code&gt; and that there are some functions that can operate on it. However, the source file does not know which members the structure contains or what the functions do. Therefore, it cannot directly modify the structure unless it forcibly casts the pointer to some known type.&lt;/p&gt;&#xA;&lt;h3 id=&#34;inheritance&#34;&gt;Inheritance&#xA;&lt;/h3&gt;&lt;p&gt;Define another structure:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;typedef&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;struct&lt;/span&gt; CounterPlusPlus&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Counter pref;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;int&lt;/span&gt; step;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;} CounterPlusPlus;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And define a method:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;counter_plus_plus_increase&lt;/span&gt;(CounterPlusPlus &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;self)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    self&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;pref.a &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; self&lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt;step;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We could certainly define a function such as &lt;code&gt;int counter_plus_plus_get_value(CounterPlusPlus *self)&lt;/code&gt; to retrieve the value from our upgraded counter. But we do not need to!&lt;/p&gt;&#xA;&lt;p&gt;In a structure, members are laid out in declaration order, although padding may be inserted between them. A &lt;code&gt;CounterPlusPlus&lt;/code&gt; consists of a &lt;code&gt;Counter&lt;/code&gt; followed by an &lt;code&gt;int&lt;/code&gt;. Therefore, the address of a &lt;code&gt;CounterPlusPlus&lt;/code&gt; instance is the same as the address of its first member, &lt;code&gt;pref&lt;/code&gt;!&lt;/p&gt;&#xA;&lt;p&gt;Thus, we can cast &lt;code&gt;CounterPlusPlus *&lt;/code&gt; to &lt;code&gt;Counter *&lt;/code&gt;, pass it to &lt;code&gt;int counter_get_value(Counter *self)&lt;/code&gt;, and let the function treat it as a &lt;code&gt;Counter&lt;/code&gt;. It will work exactly as expected!&lt;/p&gt;&#xA;&lt;p&gt;This is a common approach to implementing inheritance in C. &lt;a class=&#34;link&#34; href=&#34;https://docs.gtk.org/gobject/&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;&#xA;    &gt;GObject&lt;/a&gt; uses this approach extensively, and many of its data types inherit from &lt;code&gt;GObject&lt;/code&gt; in this way.&lt;/p&gt;&#xA;&lt;h2 id=&#34;resource-management-and-ownership&#34;&gt;Resource management and ownership&#xA;&lt;/h2&gt;&lt;p&gt;C gives us the freedom to allocate and deallocate memory, but if we do not use that freedom wisely, we are very likely to run into problems such as memory leaks, double-free errors, use-after-free errors, and so on.&lt;/p&gt;&#xA;&lt;p&gt;Ownership is a convention that C programmers follow to help them manage allocated memory correctly. You can find more information about this in &lt;a class=&#34;link&#34; href=&#34;../ownership-and-lifetimes-explained&#34; &gt;my previous article&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;communicating-directly-with-hardware&#34;&gt;Communicating directly with hardware&#xA;&lt;/h2&gt;&lt;p&gt;You may know that system programming makes extensive use of C, and that C can communicate directly with hardware. Many beginner and intermediate C learners may think this is based on special C syntax introduced by the hardware interface. However, most of the time, this is not the case.&lt;/p&gt;&#xA;&lt;p&gt;Most manufacturers provide a HAL for their hardware to make it easier for developers to develop firmware and drivers. The HAL provides functions for operating the hardware. However, in most cases, the HAL itself is also written in C. So, what C constructs does a HAL use to operate the hardware?&lt;/p&gt;&#xA;&lt;p&gt;Indeed, some hardware platforms provide special machine instructions for certain operations, and these can be accessed by integrating assembly language with C. However, in most cases, communicating with hardware from C is nothing more complicated than writing something like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-c&#34; data-lang=&#34;c&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;((&lt;span style=&#34;color:#66d9ef&#34;&gt;volatile&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;uint32_t&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;*&lt;/span&gt;)&lt;span style=&#34;color:#ae81ff&#34;&gt;0x40000000UL&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Yes. You read that right, and I am not kidding. An address, a type cast, and an ordinary integer assignment. That&amp;rsquo;s all.&lt;/p&gt;&#xA;&lt;p&gt;Most hardware has &lt;em&gt;control registers&lt;/em&gt; for its operation, and you make them perform different tasks by storing values in them. Techniques such as MMIO map these registers into one or more address spaces, allowing you to access them in much the same way as ordinary memory. By reading from and writing to peripheral registers, we can configure hardware, control its operating state, and trigger supported operations. The peripheral&amp;rsquo;s internal logic interprets these register accesses and performs the corresponding actions. There are other techniques, such as PMIO, which uses a separate I/O address space on architectures that support it.&lt;/p&gt;&#xA;&lt;p&gt;Nothing magical or opaque.&lt;/p&gt;&#xA;&lt;h2 id=&#34;further-suggestions&#34;&gt;Further suggestions&#xA;&lt;/h2&gt;&lt;p&gt;The points listed above are just the tip of the iceberg.&lt;/p&gt;&#xA;&lt;p&gt;At the moment, I am using the Study mode offered by an LLM service provider to explore these topics in depth. It has generated a roadmap, and here is a list of some crucial points. I hope they help.&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Memory management and ownership&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Stack allocation versus heap allocation.&lt;/li&gt;&#xA;&lt;li&gt;Object lifetime and storage duration.&lt;/li&gt;&#xA;&lt;li&gt;Ownership, borrowing and ownership transfer.&lt;/li&gt;&#xA;&lt;li&gt;Shallow copies versus deep copies.&lt;/li&gt;&#xA;&lt;li&gt;Reference counting.&lt;/li&gt;&#xA;&lt;li&gt;Resource acquisition and release.&lt;/li&gt;&#xA;&lt;li&gt;Partial initialisation and failure cleanup.&lt;/li&gt;&#xA;&lt;li&gt;Avoiding memory leaks, double-free and use-after-free.&lt;/li&gt;&#xA;&lt;li&gt;Flexible array members.&lt;/li&gt;&#xA;&lt;li&gt;Alignment and padding.&lt;/li&gt;&#xA;&lt;li&gt;Allocation-size overflow.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;API design and encapsulation&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Opaque structures.&lt;/li&gt;&#xA;&lt;li&gt;Public headers and private headers.&lt;/li&gt;&#xA;&lt;li&gt;Constructors and destructors.&lt;/li&gt;&#xA;&lt;li&gt;Initialisers and finalisers.&lt;/li&gt;&#xA;&lt;li&gt;Getters and setters.&lt;/li&gt;&#xA;&lt;li&gt;Reference counting APIs.&lt;/li&gt;&#xA;&lt;li&gt;Copying and cloning.&lt;/li&gt;&#xA;&lt;li&gt;Function contracts.&lt;/li&gt;&#xA;&lt;li&gt;Preconditions and postconditions.&lt;/li&gt;&#xA;&lt;li&gt;Error reporting.&lt;/li&gt;&#xA;&lt;li&gt;API documentation.&lt;/li&gt;&#xA;&lt;li&gt;Namespace conventions.&lt;/li&gt;&#xA;&lt;li&gt;Callback APIs.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;The complete compilation process&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Preprocessing.&lt;/li&gt;&#xA;&lt;li&gt;Compilation.&lt;/li&gt;&#xA;&lt;li&gt;Assembly.&lt;/li&gt;&#xA;&lt;li&gt;Linking.&lt;/li&gt;&#xA;&lt;li&gt;Translation units.&lt;/li&gt;&#xA;&lt;li&gt;Object files.&lt;/li&gt;&#xA;&lt;li&gt;Symbol tables.&lt;/li&gt;&#xA;&lt;li&gt;Undefined symbols.&lt;/li&gt;&#xA;&lt;li&gt;Symbol visibility.&lt;/li&gt;&#xA;&lt;li&gt;Static libraries.&lt;/li&gt;&#xA;&lt;li&gt;Shared libraries.&lt;/li&gt;&#xA;&lt;li&gt;Position-independent code.&lt;/li&gt;&#xA;&lt;li&gt;Runtime library loading.&lt;/li&gt;&#xA;&lt;li&gt;Dynamic linking.&lt;/li&gt;&#xA;&lt;li&gt;ABI compatibility.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Advanced pointer techniques&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pointer arithmetic.&lt;/li&gt;&#xA;&lt;li&gt;Arrays and pointers: their similarities and differences.&lt;/li&gt;&#xA;&lt;li&gt;Pointer-to-pointer (&lt;code&gt;T **&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Pointers to arrays.&lt;/li&gt;&#xA;&lt;li&gt;Function pointers.&lt;/li&gt;&#xA;&lt;li&gt;Pointers to structures.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;const&lt;/code&gt; correctness.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;restrict&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;void *&lt;/code&gt; and generic programming.&lt;/li&gt;&#xA;&lt;li&gt;Null pointers and invalid pointers.&lt;/li&gt;&#xA;&lt;li&gt;Pointer lifetime and aliasing rules.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Structures and data-oriented design&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Structure composition.&lt;/li&gt;&#xA;&lt;li&gt;Opaque structures.&lt;/li&gt;&#xA;&lt;li&gt;Public versus private structures.&lt;/li&gt;&#xA;&lt;li&gt;Tagged unions.&lt;/li&gt;&#xA;&lt;li&gt;Enumerations.&lt;/li&gt;&#xA;&lt;li&gt;Bit-fields and their portability limitations.&lt;/li&gt;&#xA;&lt;li&gt;Structure padding and alignment.&lt;/li&gt;&#xA;&lt;li&gt;Flexible array members.&lt;/li&gt;&#xA;&lt;li&gt;Intrusive versus non-intrusive data structures.&lt;/li&gt;&#xA;&lt;li&gt;Structure initialisation.&lt;/li&gt;&#xA;&lt;li&gt;Compound literals.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;C strings and binary data&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Null-terminated strings.&lt;/li&gt;&#xA;&lt;li&gt;Character arrays.&lt;/li&gt;&#xA;&lt;li&gt;Buffer sizes and capacities.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;strlen()&lt;/code&gt;, &lt;code&gt;strcmp()&lt;/code&gt;, &lt;code&gt;memcpy()&lt;/code&gt; and &lt;code&gt;memmove()&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Safe string construction.&lt;/li&gt;&#xA;&lt;li&gt;Dynamic string buffers.&lt;/li&gt;&#xA;&lt;li&gt;UTF-8.&lt;/li&gt;&#xA;&lt;li&gt;Character encoding versus byte representation.&lt;/li&gt;&#xA;&lt;li&gt;Integer formatting and &lt;code&gt;printf()&lt;/code&gt; format specifiers.&lt;/li&gt;&#xA;&lt;li&gt;Format-string vulnerabilities.&lt;/li&gt;&#xA;&lt;li&gt;Binary data handling.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Integer types and undefined behaviour&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Integer promotions.&lt;/li&gt;&#xA;&lt;li&gt;Signed and unsigned arithmetic.&lt;/li&gt;&#xA;&lt;li&gt;Integer overflow.&lt;/li&gt;&#xA;&lt;li&gt;Integer conversions.&lt;/li&gt;&#xA;&lt;li&gt;Fixed-width integer types (&lt;code&gt;uint32_t&lt;/code&gt;, &lt;code&gt;int64_t&lt;/code&gt;, etc.).&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;size_t&lt;/code&gt;, &lt;code&gt;ptrdiff_t&lt;/code&gt; and &lt;code&gt;uintptr_t&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Endianness.&lt;/li&gt;&#xA;&lt;li&gt;Alignment.&lt;/li&gt;&#xA;&lt;li&gt;Undefined behaviour.&lt;/li&gt;&#xA;&lt;li&gt;Unspecified behaviour.&lt;/li&gt;&#xA;&lt;li&gt;Implementation-defined behaviour.&lt;/li&gt;&#xA;&lt;li&gt;Strict aliasing.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Error handling&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Return-value-based error handling.&lt;/li&gt;&#xA;&lt;li&gt;Error codes.&lt;/li&gt;&#xA;&lt;li&gt;Error output parameters.&lt;/li&gt;&#xA;&lt;li&gt;The &lt;code&gt;goto&lt;/code&gt; cleanup pattern.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Data structures and algorithms in C&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Dynamic arrays.&lt;/li&gt;&#xA;&lt;li&gt;Linked lists.&lt;/li&gt;&#xA;&lt;li&gt;Doubly linked lists.&lt;/li&gt;&#xA;&lt;li&gt;Hash tables.&lt;/li&gt;&#xA;&lt;li&gt;Trees.&lt;/li&gt;&#xA;&lt;li&gt;Binary search trees.&lt;/li&gt;&#xA;&lt;li&gt;Balanced trees.&lt;/li&gt;&#xA;&lt;li&gt;Queues.&lt;/li&gt;&#xA;&lt;li&gt;Stacks.&lt;/li&gt;&#xA;&lt;li&gt;Heaps.&lt;/li&gt;&#xA;&lt;li&gt;Ring buffers.&lt;/li&gt;&#xA;&lt;li&gt;String builders.&lt;/li&gt;&#xA;&lt;li&gt;Iterators.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Function pointers, callbacks and polymorphism&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Callback registration.&lt;/li&gt;&#xA;&lt;li&gt;Function pointers.&lt;/li&gt;&#xA;&lt;li&gt;Function pointers inside structures.&lt;/li&gt;&#xA;&lt;li&gt;Virtual-function-table patterns.&lt;/li&gt;&#xA;&lt;li&gt;Interface implementation.&lt;/li&gt;&#xA;&lt;li&gt;Event handlers.&lt;/li&gt;&#xA;&lt;li&gt;User-data pointers.&lt;/li&gt;&#xA;&lt;li&gt;Plugin interfaces.&lt;/li&gt;&#xA;&lt;li&gt;Dynamic dispatch.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;The operating system interface&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Standard C library versus operating-system APIs.&lt;/li&gt;&#xA;&lt;li&gt;POSIX.&lt;/li&gt;&#xA;&lt;li&gt;File descriptors.&lt;/li&gt;&#xA;&lt;li&gt;File streams (&lt;code&gt;FILE *&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;File operations.&lt;/li&gt;&#xA;&lt;li&gt;Directories and paths.&lt;/li&gt;&#xA;&lt;li&gt;Processes.&lt;/li&gt;&#xA;&lt;li&gt;Environment variables.&lt;/li&gt;&#xA;&lt;li&gt;Pipes.&lt;/li&gt;&#xA;&lt;li&gt;Signals.&lt;/li&gt;&#xA;&lt;li&gt;Sockets.&lt;/li&gt;&#xA;&lt;li&gt;Memory mapping (&lt;code&gt;mmap()&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;System calls.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Concurrency and multithreading&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Processes versus threads.&lt;/li&gt;&#xA;&lt;li&gt;POSIX threads.&lt;/li&gt;&#xA;&lt;li&gt;Mutexes.&lt;/li&gt;&#xA;&lt;li&gt;Condition variables.&lt;/li&gt;&#xA;&lt;li&gt;Semaphores.&lt;/li&gt;&#xA;&lt;li&gt;Atomic operations.&lt;/li&gt;&#xA;&lt;li&gt;Data races.&lt;/li&gt;&#xA;&lt;li&gt;Deadlocks.&lt;/li&gt;&#xA;&lt;li&gt;Thread safety.&lt;/li&gt;&#xA;&lt;li&gt;Thread-local storage.&lt;/li&gt;&#xA;&lt;li&gt;Memory ordering.&lt;/li&gt;&#xA;&lt;li&gt;Event loops.&lt;/li&gt;&#xA;&lt;li&gt;Asynchronous programming.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Event-driven programming&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Event loops.&lt;/li&gt;&#xA;&lt;li&gt;Event queues.&lt;/li&gt;&#xA;&lt;li&gt;Event dispatching.&lt;/li&gt;&#xA;&lt;li&gt;Callbacks.&lt;/li&gt;&#xA;&lt;li&gt;Timers.&lt;/li&gt;&#xA;&lt;li&gt;Input events.&lt;/li&gt;&#xA;&lt;li&gt;Window events.&lt;/li&gt;&#xA;&lt;li&gt;Asynchronous operations.&lt;/li&gt;&#xA;&lt;li&gt;Application lifecycle.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Build systems&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GNU Make&lt;/li&gt;&#xA;&lt;li&gt;Autoconf and Automake&lt;/li&gt;&#xA;&lt;li&gt;Meson&lt;/li&gt;&#xA;&lt;li&gt;CMake&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Library installation and dependency management&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Include directories.&lt;/li&gt;&#xA;&lt;li&gt;Library directories.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;pkg-config&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;.pc&lt;/code&gt; files.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;PKG_CONFIG_PATH&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Static versus shared linking.&lt;/li&gt;&#xA;&lt;li&gt;Runtime library paths.&lt;/li&gt;&#xA;&lt;li&gt;Installation prefixes.&lt;/li&gt;&#xA;&lt;li&gt;Header installation.&lt;/li&gt;&#xA;&lt;li&gt;Library versioning.&lt;/li&gt;&#xA;&lt;li&gt;Dependency discovery.&lt;/li&gt;&#xA;&lt;li&gt;Transitive dependencies.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Debugging&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GDB.&lt;/li&gt;&#xA;&lt;li&gt;Breakpoints.&lt;/li&gt;&#xA;&lt;li&gt;Backtraces.&lt;/li&gt;&#xA;&lt;li&gt;Stack frames.&lt;/li&gt;&#xA;&lt;li&gt;Variable inspection.&lt;/li&gt;&#xA;&lt;li&gt;Core dumps.&lt;/li&gt;&#xA;&lt;li&gt;Watchpoints.&lt;/li&gt;&#xA;&lt;li&gt;Debug symbols.&lt;/li&gt;&#xA;&lt;li&gt;Debugging optimised programmes.&lt;/li&gt;&#xA;&lt;li&gt;Debugging segmentation faults.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Memory and undefined-behaviour detection&#xA;&lt;ul&gt;&#xA;&lt;li&gt;AddressSanitizer, for out-of-bounds access, use-after-free and other memory errors.&lt;/li&gt;&#xA;&lt;li&gt;UndefinedBehaviorSanitizer, for various forms of undefined behaviour.&lt;/li&gt;&#xA;&lt;li&gt;Valgrind Memcheck, for invalid memory access, uninitialised values and memory leaks.&lt;/li&gt;&#xA;&lt;li&gt;MemorySanitizer, for use of uninitialised memory.&lt;/li&gt;&#xA;&lt;li&gt;Static analysis, for potential defects without executing the programme.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Software testing&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Unit testing.&lt;/li&gt;&#xA;&lt;li&gt;Integration testing.&lt;/li&gt;&#xA;&lt;li&gt;Regression testing.&lt;/li&gt;&#xA;&lt;li&gt;Test fixtures.&lt;/li&gt;&#xA;&lt;li&gt;Test assertions.&lt;/li&gt;&#xA;&lt;li&gt;Boundary testing.&lt;/li&gt;&#xA;&lt;li&gt;Error-path testing.&lt;/li&gt;&#xA;&lt;li&gt;Memory-leak testing.&lt;/li&gt;&#xA;&lt;li&gt;Fuzz testing.&lt;/li&gt;&#xA;&lt;li&gt;Continuous integration.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Performance analysis&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Algorithmic complexity.&lt;/li&gt;&#xA;&lt;li&gt;Cache locality.&lt;/li&gt;&#xA;&lt;li&gt;Memory allocation overhead.&lt;/li&gt;&#xA;&lt;li&gt;Profiling.&lt;/li&gt;&#xA;&lt;li&gt;CPU profiling.&lt;/li&gt;&#xA;&lt;li&gt;Memory profiling.&lt;/li&gt;&#xA;&lt;li&gt;Benchmarking.&lt;/li&gt;&#xA;&lt;li&gt;Data-oriented optimisation.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Coding conventions and readability&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Naming conventions.&lt;/li&gt;&#xA;&lt;li&gt;Indentation.&lt;/li&gt;&#xA;&lt;li&gt;Function organisation.&lt;/li&gt;&#xA;&lt;li&gt;Header organisation.&lt;/li&gt;&#xA;&lt;li&gt;Comments.&lt;/li&gt;&#xA;&lt;li&gt;Documentation comments.&lt;/li&gt;&#xA;&lt;li&gt;Naming public and private symbols.&lt;/li&gt;&#xA;&lt;li&gt;File organisation.&lt;/li&gt;&#xA;&lt;li&gt;Avoiding unnecessary macros.&lt;/li&gt;&#xA;&lt;li&gt;Avoiding unnecessary global variables.&lt;/li&gt;&#xA;&lt;li&gt;Keeping functions understandable.&lt;/li&gt;&#xA;&lt;li&gt;Maintaining consistency.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Documentation&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Public functions.&lt;/li&gt;&#xA;&lt;li&gt;Function parameters.&lt;/li&gt;&#xA;&lt;li&gt;Return values.&lt;/li&gt;&#xA;&lt;li&gt;Error conditions.&lt;/li&gt;&#xA;&lt;li&gt;Ownership transfer.&lt;/li&gt;&#xA;&lt;li&gt;Object lifecycle.&lt;/li&gt;&#xA;&lt;li&gt;Thread-safety guarantees.&lt;/li&gt;&#xA;&lt;li&gt;API stability.&lt;/li&gt;&#xA;&lt;li&gt;Examples of usage.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;API and ABI stability&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is an API?&lt;/li&gt;&#xA;&lt;li&gt;What is an ABI?&lt;/li&gt;&#xA;&lt;li&gt;What constitutes an incompatible change?&lt;/li&gt;&#xA;&lt;li&gt;Why exposing structure members can be problematic.&lt;/li&gt;&#xA;&lt;li&gt;Symbol visibility.&lt;/li&gt;&#xA;&lt;li&gt;Shared-library versioning.&lt;/li&gt;&#xA;&lt;li&gt;Deprecation.&lt;/li&gt;&#xA;&lt;li&gt;Backwards compatibility.&lt;/li&gt;&#xA;&lt;li&gt;Parallel installation of different library versions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Internationalisation and localisation&#xA;&lt;ul&gt;&#xA;&lt;li&gt;UTF-8.&lt;/li&gt;&#xA;&lt;li&gt;Character encodings.&lt;/li&gt;&#xA;&lt;li&gt;Locales.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;gettext&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Translation catalogues.&lt;/li&gt;&#xA;&lt;li&gt;Plural forms.&lt;/li&gt;&#xA;&lt;li&gt;Date and number formatting.&lt;/li&gt;&#xA;&lt;li&gt;Translating error messages.&lt;/li&gt;&#xA;&lt;li&gt;Avoiding hard-coded user-facing strings.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Git and collaborative development&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Repositories.&lt;/li&gt;&#xA;&lt;li&gt;Commits.&lt;/li&gt;&#xA;&lt;li&gt;Branches.&lt;/li&gt;&#xA;&lt;li&gt;Merging.&lt;/li&gt;&#xA;&lt;li&gt;Rebasing.&lt;/li&gt;&#xA;&lt;li&gt;Diff inspection.&lt;/li&gt;&#xA;&lt;li&gt;Conflict resolution.&lt;/li&gt;&#xA;&lt;li&gt;Patch creation.&lt;/li&gt;&#xA;&lt;li&gt;Code review.&lt;/li&gt;&#xA;&lt;li&gt;Issue reporting.&lt;/li&gt;&#xA;&lt;li&gt;Release branches.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Or a simplified version:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Stage 1 — Idiomatic C&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Memory ownership and lifetimes.&lt;/li&gt;&#xA;&lt;li&gt;Advanced pointers and structures.&lt;/li&gt;&#xA;&lt;li&gt;String and buffer handling.&lt;/li&gt;&#xA;&lt;li&gt;Error handling.&lt;/li&gt;&#xA;&lt;li&gt;Data structures.&lt;/li&gt;&#xA;&lt;li&gt;Function pointers and callbacks.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Stage 2 — Library engineering&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Opaque types and API design.&lt;/li&gt;&#xA;&lt;li&gt;Header and source organisation.&lt;/li&gt;&#xA;&lt;li&gt;Static and shared libraries.&lt;/li&gt;&#xA;&lt;li&gt;Compilation and linking.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;pkg-config&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;ABI and API stability.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Stage 3 — Professional C development&#xA;&lt;ul&gt;&#xA;&lt;li&gt;POSIX and system programming.&lt;/li&gt;&#xA;&lt;li&gt;Build systems.&lt;/li&gt;&#xA;&lt;li&gt;Debugging and profiling.&lt;/li&gt;&#xA;&lt;li&gt;Unit and integration testing.&lt;/li&gt;&#xA;&lt;li&gt;Sanitizers and static analysis.&lt;/li&gt;&#xA;&lt;li&gt;Documentation and coding conventions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Stage 4 — Ecosystem development&#xA;&lt;ul&gt;&#xA;&lt;li&gt;GLib and GObject.&lt;/li&gt;&#xA;&lt;li&gt;GNU development practices.&lt;/li&gt;&#xA;&lt;li&gt;SDL development practices.&lt;/li&gt;&#xA;&lt;li&gt;Git and collaborative development.&lt;/li&gt;&#xA;&lt;li&gt;API compatibility.&lt;/li&gt;&#xA;&lt;li&gt;Contributing patches to established projects.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;</description>
        </item></channel>
</rss>
