<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Learn C With Me #08 — Structs | Live</title>
        <link>https://watch.linuxrenaissance.com/videos/watch/764edf83-5585-48d3-a42d-1e9df8fbcee8</link>
        <description>In Lesson 8 of Learn C With Me, we dive into structs in C — a way to group multiple pieces of related data, potentially of different types, into a single user-defined type. Using Beej's Guide to C as our study material, we start with the basics of declaring a struct and gradually work our way through initialization, pointers to structs, passing structs to functions, copying them, and comparing them. We cover: What a struct is and why it is useful, Creating a user-defined type with struct, Declaring variables of a struct type, Accessing fields with the dot operator (.), Struct initializers, Initializing fields in declaration order, Designated initializers, Why designated initializers are safer when field order changes, What happens to fields that aren't explicitly initialized, Passing structs to functions, Passing a complete struct versus passing a pointer to a struct, Why passing a pointer can avoid unnecessary copying, Modifying the original struct from inside a function, Function declarations and why the compiler needs to know about a function before it is called, Dereferencing a pointer to a struct, The arrow operator (→), Why ptr→field is equivalent to (*ptr).field, When to use . and when to use →, Copying structs, Returning structs from functions, The difference between a shallow copy and a deep copy, Why copying a struct also copies any pointer values it contains, Comparing structs, Why the safest approach is to compare individual fields one by one, One of the most useful parts of this lesson is seeing why pointers to structs are so common in C. Passing an entire struct to a function makes a copy, while passing a pointer allows the function to work with the original object and can also be much cheaper when the struct is large. We also meet the arrow operator for the first time. Instead of writing something like (*car).price, C lets us write the much cleaner car→price. The two forms mean the same thing — the arrow is simply convenient syntax for accessing a field through a pointer to a struct. Later, we look at copying structs and discover that a normal assignment performs a shallow copy. The fields themselves are copied, including pointer values, but the data those pointers refer to is not duplicated automatically. C doesn't provide built-in deep-copy behavior for structs. Finally, we look at comparing structs and learn that there isn't a general-purpose struct equality operator in C. The safe approach is to compare the relevant fields individually, rather than assuming the raw memory representation will always be suitable for comparison. As usual, we experiment with the examples, hit compiler errors, stop when something doesn't make sense, work through it with the live chat, and try to understand what C is actually doing under the hood rather than just memorizing syntax. This is an interactive, follow-along live course. I am learning C alongside you, so expect questions, mistakes, experiments and plenty of discussion. No passive watching here — participate in the chat and work through the examples with us. 📅 We go live every Saturday at 19:00 CEST — interactive, follow-along C programming sessions. 📖 Study material: Beej's Guide to C 📚 Course materials: Linux Renaissance C Programming Course 💬 Homework &amp; discussion: Linux Renaissance Forum 📺 All C Programming lessons: C Programming playlist 🔴 This stream is proudly sponsored by OPNsense — the open source firewall and routing platform trusted by professionals worldwide. OPNsense Support Linux Renaissance🛒 Shop: Linux Renaissance Shop ☕ Ko-fi: Ko-fi 🎖️ Patreon: Patreon ▶️ YouTube membership: YouTube Membership Find me elsewhere🌐 Blog: Linux Renaissance 🎥 PeerTube: Linux Renaissance on PeerTube 📺 Odysee: Linux Renaissance on Odysee 🎮 Twitch: Linux Renaissance on Twitch 💬 Matrix: Linux Renaissance Matrix space</description>
        <lastBuildDate>Wed, 16 Sep 2026 14:22:55 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>PeerTube - https://watch.linuxrenaissance.com</generator>
        <image>
            <title>Learn C With Me #08 — Structs | Live</title>
            <url>https://watch.linuxrenaissance.com/lazy-static/avatars/9c56e2c1-4172-455c-9801-e3a8bad36429.gif</url>
            <link>https://watch.linuxrenaissance.com/videos/watch/764edf83-5585-48d3-a42d-1e9df8fbcee8</link>
        </image>
        <copyright>All rights reserved, unless otherwise specified in the terms specified at https://watch.linuxrenaissance.com/about and potential licenses granted by each content's rightholder.</copyright>
        <atom:link href="https://watch.linuxrenaissance.com/feeds/video-comments.xml?videoId=764edf83-5585-48d3-a42d-1e9df8fbcee8" rel="self" type="application/rss+xml"/>
    </channel>
</rss>