A structure is a collection of variables of different data types, under a single name. As with most programming languages, we define a structure type by using the struct keyword. In the following example, we declare a structure with two members:

struct car {    string  Brand;    string  Rnumber;}

Here, the struct represents a car by defining its brand and registration number. We then declare a car object by using car public Mycar;.

Get Blockchain By Example now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.