Loading...
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
Structures (struct) allow you to group variables of different data types under a single name. They represent a "record" or "entity".
struct Student {
string name;
int age;
double gpa;
};
Student s1 = {"Alice", 20, 3.8};
cout << s1.name; // Access with dot (.)Unlike arrays, members can be of different types.
All members of a struct are public unless specified otherwise.
Used to build complex nodes in data structures like Linked Lists (struct Node) or Trees.
struct Node { int data; Node* next; };