what is mean by structure data type?? explain it with example
Answers
Answered by
1
A data structure is a group of data elements grouped together under one name. These data elements, known as members, can have different types and different lengths. Data structures can be declared in C++ using the following syntax:
struct type_name {
member_type1 member_name1;
member_type2 member_name2;
member_type3 member_name3;
.
.
} object_names;
Where type_name is a name for the structure type, object_name can be a set of valid identifiers for objects that have the type of this structure. Within braces {}, there is a list with the data members, each one is specified with a type and a valid identifier as its name.
For example :
struct student_info
{
int admin_no;
char name[50];
int class;
int rollno;
char address [100];
}student_profile[100];
struct type_name {
member_type1 member_name1;
member_type2 member_name2;
member_type3 member_name3;
.
.
} object_names;
Where type_name is a name for the structure type, object_name can be a set of valid identifiers for objects that have the type of this structure. Within braces {}, there is a list with the data members, each one is specified with a type and a valid identifier as its name.
For example :
struct student_info
{
int admin_no;
char name[50];
int class;
int rollno;
char address [100];
}student_profile[100];
harini1310:
thank you so much
Similar questions
Social Sciences,
6 months ago
Political Science,
6 months ago
Math,
11 months ago
Science,
11 months ago
English,
1 year ago