Accessing Structure Members
Introduction :
- Array elements are accessed using the Subscript variable , Similarly Structure members are accessed using dot [.] operator.
- (.) is called as "Structure member Operator".
- Use this Operator in between "Structure name" & "member name"
struct Vehicle
{
int wheels;
char vname[20];
char color[10];
}v1 = {4,"Nano","Red"};
-- -- -- --
-- -- -- --
-- -- -- --
void main()
{
printf("Vehicle No of Wheels : %d",v1.wheels);
printf("Vehicle Name : %s",v1.vname);
printf("Vehicle Color : %s",v1.color);
}
Output :Note :Vehicle No of Wheels : 4 Vehicle Name : Nano Vehicle Color : Red
- Dot operator has Highest Priority than unary,arithmetic,relational,logical Operators
Bookmark & Share

0 comments
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email