![]() |
In C, we can create an array whose elements are of struct type. In this article, we will learn how to access an array of structures in C. For Example, Input: Accessing Array of Structure Members in CWe can access the array of structures in a very similar to accessing array elements. To access members of an array of structures we can use the array indexing and access individual fields of a struct using the dot operator. Syntax to Access Array of Structure in CarrayName[index].member;
Here,
C Program to Access Array of Struct MembersThe below program demonstrates how we can access an array of structures in C. C
Output
Struct at index 0: ID = 1, Name = Person1 Struct at index 1 after modifying: ID = 3, Name = Person2 Time Complexity: O(1) |
Reffered: https://www.geeksforgeeks.org
C Language |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 15 |