Array of Objects Structure in C


An array of structures in C can be defined as the collection of multiple structures variables where each variable contains information about different entities. The array of structures in C are used to store information about multiple entities of different data types. The array of structures is also known as the collection of structures.

Source Code

//Array of Structure Objects
 
#include<stdio.h>
struct student
{
    char *name;
    int age;
    float per;
};
int main()
{
    struct student o[2];
 
    o[0].name="Ram Kumar";
    o[0].age=25;
    o[0].per=65.25;
 
    o[1].name="Sam Kumar";
    o[1].age=12;
    o[1].per=80;
 
    printf("\n------------------------------");
    printf("\nName        : %s",o[0].name);
    printf("\nAge         : %d",o[0].age);
    printf("\nPercent     : %f",o[0].per);
    printf("\n------------------------------");
    printf("\nName        : %s",o[1].name);
    printf("\nAge         : %d",o[1].age);
    printf("\nPercent     : %f",o[1].per);
    printf("\n------------------------------\n\n");
 
    return 0;
}
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes