In this recipe, we will make a structure that stores the information of an order placed by a specific customer. A structure is a user-defined data type that can store several members of different data types within it. The structure will have members for storing the order number, email address, and password of the customer:
struct cart
{
int orderno;
char emailaddress[30];
char password[30];
};
The preceding structure is named cart, and comprises three members – orderno of the int type for storing the order number of the order placed by the customer, and emailaddress and password of the string type for storing the email address and password of the customer, respectively. Let's begin!