Structures, Unions, Enumerations and Bit-Fields

Learning Objectives

In this chapter, you will learn about:

  • User-defined data types
  • Structures
  • How to define new data types using structures
  • How to declare objects of the newly created structure type
  • Various operations that can be applied on the objects of a structure type
  • Arrays, pointers, functions and structures used in conjunction
  • Creating syntactically convenient name for user-defined types
  • Unions
  • Difference between structures and unions
  • Application of unions in interrupt programming
  • Enumerations
  • Storing information less than a byte by making use of bit-fields

9.1 Introduction

In previous chapters, you have seen that C language provides a rich set of primitive and derived data types ...

Get Programming in C: A Practical Approach, First Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.