O'Reilly logo

SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION by Jesse Liberty

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

Declaring Structure Types

Enumeration types are useful, but there are more powerful types you can declare, called structure types.

Structure types let you bundle up a set of member variables into a single variable. Then you can keep related data together in a single package and pass it around just as you pass an int or a char. You can even make an array of structures.

A structure type is declared with keyword struct, a name, and any number of typed members:

struct typename
{
   type membervariablename...
} ;

Here's an example:

struct aTapeElement
{
   char Operator;
   float Operand;
} ;

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