⧼⧼  Previous Page
⧼  Table of Contents  ⧽
Next Page  ⧽⧽

Structs

Computer Programming C++ / Defining New Data-Types

A struct (data structure) is a group of related variables. These variables, refered to as members, can have different types and different lengths.

Struct members can contain pretty much any type of data. The only thing that you cannot have is a struct that contains a member of it's own type. This video will explain why.

There is another common way to create instances of your struct-type, but often this leads to having global variables. This video explains why globals are not good programming practice.

Review Questions

The following are examples of questions similar to what you can expect to see on the next exam.

Hover over a question to show the answer.
  1. How many members can a struct have? As many as you want.
  2. Can a struct contain another struct as a member? Yes, as long as theres no cyclical dependence.
⧼⧼  Previous Page
⧼  Table of Contents  ⧽
Next Page  ⧽⧽
© Ryan Appel