Arrays within structures in C allow you to define a structure that contains an array as one of its members. This enables you to organize and store related data in a more structured and logical manner.
struct structure_name { data_type member1; data_type member2; // ... data_type array_member[N]; // Array as a member // ... };
Program.c
The program defines a structure Student with members name, age, and marks (an array of floats). It initializes a structure variable student1 with sample data. It prints the student's name, age, and marks using the structure variable.
Student Name: John Doe Age: 20 Marks: 85.50 90.00 78.50 92.00 88.50
With supporting text below as a natural lead-in to additional content.