Advertisement

Structs

  • Mikael Olsson
Chapter

Abstract

A struct or structure is a user-defined type used for grouping a collection of related variables under a single name. To define a structure you use the struct keyword, followed by an optional identifier and a code block containing variable declarations. The definition of this new type ends with a semicolon.

struct point {
  int x, y;
};

Copyright information

© Mikael Olsson 2019

Authors and Affiliations

  • Mikael Olsson
    • 1
  1. 1.Hammarland, Länsi-SuomiFinland

Personalised recommendations