Accessing Structure Members

1.Array elements are accessed using the Subscript variable , Similarly Structure members are accessed using dot [.] operator.​​​​​​

2.(.) is called as “Structure member Operator”.

3.Use this Operator in between “Structure name” & “member name”

Example

#include<stdio.h>
struct Vehicle 
{
int wheels;
char vname[20];
char color[10];}v1 = {4," Swift Desire "," White "};
int main(){
printf(Vehicle No of Wheels : %d",v1.wheels);
printf(Vehicle Name : %s",v1.vname);
printf(Vehicle Color : %s",v1.color);
return(0);
}

Output

Vehicle No of Wheels : 4
Vehicle Name : Swift Desire
Vehicle Color : White