Home | Projects | Notes > C Programming > Structures

Structures

 

Introduction to Structures

Defining a structure does not incur memory allocation. Its just a description or a record.

 

Exercise

Write a program to create a carModel structure and create 2 variables of type struct carModel. Initialize the variables with the below given data and then print them.

  1. 2021, 15000, 220, 1330

  2. 4031, 35000, 160, 1900.96

 

Size of a Structure

 

Aligned/Unaligned Data Storage

 

typedef with Structures

 

Self-Referential Structures

 

Nested Structures

 

Accessing Members of a Structure

 

Exercise

 

Structures and Bit Fields

 

Exercise - Bit Fields

 

Usage of Bit Fields in an Embedded Program

 

 

References

Nayak, K. (2022). Microcontroller Embedded C Programming: Absolute Beginners [Video file]. Retrieved from https://www.udemy.com/course/microcontroller-embedded-c-programming/