Structures, Unions & File I/O

User-Defined Structures (struct)

Group multiple different data types under a single custom structure name.

What is a Structure (struct)? A structure groups variables of DIFFERENT data types (int, float, char array) under a single custom record.

#include <stdio.h>

struct Student { int roll; char name[20]; float marks; };

int main() { struct Student s1 = {101, "Aarav", 94.5f}; printf("Roll: %d | Name: %s | Marks: %.1f\n", s1.roll, s1.name, s1.marks); return 0; } ```