O'Reilly logo

Advanced Topics in C: Core Concepts in Data Structures by Noel Kalicharan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 2

image

Structures

In this chapter, we will explain the following:

  • What a structure is
  • How to declare a structure
  • How to use typedef to work with structures more conveniently
  • How to work with an array of structures
  • How to search an array of structures
  • How to sort an array of structures
  • How to declare nested structures
  • How to use structures to manipulate fractions
  • How to use structures to solve a “voting” problem
  • How structures can be passed to a function

2.1 Defining Structures

In C, a structure is a collection of one or more variables, possibly of different types, grouped together under a single name for convenient handling.

There are many ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required