#
struct keyword in C++

The struct keyword was introduced in 'C', its original functionality is documented here.

C++ has added two new features to structures.

1. The syntax has been improved slightly so you no longer have to mess around with typedef statements.

   ### ANSI C approch to structures.

           typedef struct Person {int age; char *name} Person_t;

           struct Person FirstMan;
           Person_t      SecondMan;

   ### C++ structures.

           struct Person {int age; char *name};

           Person FirstMan;
           Person SecondMan;

2. C++ also took the original idea of structures and added the ability to associate functions with the data within the structure. This feature was wrapped up with the introduction of the class keyword.

## Examples:

Example program.

## See Also:

C++ Keywords
C Keywords

Top | Master Index | C++ Keywords | Functions