Accessing structure member

To access structure members we can use dot operator (.) between structure name and structure member name.

For Example:
 structure_name.structure_member

For example to access street name of structure address we do as follows:
struct address billing_addr;
billing_addr.country = "US";

If the structure contains another structure, we can use dot operator to access nested structure and use dot operator again to access variables of nested structure.
struct customer jack;

jack.billing_addr.country = "US";

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

Back