Page 10 - Data Struct
P. 10
10
Algorithm and Data Structure
Structure in C++
A data structure is a set of various data types that may have different
length grouped together under a unique declaration.
Structure is also known as record.Ex : A database is to created for the
student profiles in college. Each profiles in a college. Each profiles
include name, address, age, phone_number
Syntax declaration a struct
struct struct_name
{
member1
member2
member3
} struct_variable;
Example 1 Example 2
struct student struct student
{ {
char name [20]; char name [20];
char address [30]; char address [30];
int age; int age;
int phone; int phone;
};
} sem1;
student sem1

