Your Eleventh Day in C (Unions in C) - Crash Course in C Programming

preview_player
Показать описание

►Lesson Description: In this lessons I show you how to use a 'union' in the C programming language. At this point in the series, we'll have covered most of the major language C programming features that a C programmer would see in most C texts. Unions are not intuitive at first, because it is weird to see how a collection of bytes can be treated differently (sort of like casting, but unions provide more information into 'what types can we treat these bytes as').

I'll start this example showing how a union works with a simple example. Then I'll show where unions are used in the real world. Finally, unions can often be used as a way to 'address' bytes in different ways which I'll show as an example at the end.

00:00 Introduction
00:40 Definition of Unions and difference from structs
2:35 First example of a union
6:40 Understanding behavior of unions
9:45 Example of unions used in SDL2
11:12 matrix_t example with a union
19:54 Wrap up

►Please like and subscribe to help the channel!
Рекомендации по теме
Комментарии
Автор

Great learning C language series! Is there anything wrong learning C and C++ at the same time?

GaryChike