Initializing structure

You can define structure as a custom data type therefore you can initialize a structure like a variable.
Example:
struct product{
      char name[50];
      double price;
    } book = { "C programming language",40.5};
In above example, we define product structure, then we declare and initialize book structure with its name and price.

The reference site for this content is http://cprogramminglanguage.net/c-structure.aspx

Back