Enjoying the preview?
This is the free first lesson. Get full access — request a demo or sign in.
Enjoying the preview?
This is the free first lesson. Get full access — request a demo or sign in.
Unlike many more modern programming languages, C does not have a wide variety of libraries for supplying advanced data structures. In these lessons, we’ll go over two other data structures you can use in C, the struct and the union.
We’ll go over how to define structs—special data structures that allow a programmer to create composite data types—how to create struct objects, how to add data to them, and how to use them in programs. You’ll also learn about unions, which allow one variable to hold more than one data type as a value. We’ll demonstrate how to create unions, how to assign data to them, how to access the data stored in a union, and what happens when you try to access a union's field when it’s not currently storing a value.
It covers two data structures you can use in C: the struct and the union. You learn how to define structs, create struct objects, add data to them, use them in programs (including as function arguments), and how to create unions, assign data to them, and access the data stored in a union. It also covers creating and using constants.
A struct is a special data structure that lets a programmer create composite data types, while a union allows one variable to hold more than one data type as a value.
It builds skills in C (Programming Language), C Compilers, C Data Types, C-Based Programming Languages, Data Structures, and Modular Programming in C.
The lessons are Creating Structs, Using Structs, Structs as Function Arguments, Creating and Using Unions, and Creating and Using Constants.
Unlike many more modern programming languages, C does not have a wide variety of libraries for supplying advanced data structures, so structs and unions are two data structures you can use in C.