SlideShare a Scribd company logo
CONTENTS :
 Introduction of structure
 Array of structure
 Nested structure
 Structure with pointer
Introduction -
In C/C++, struct keyword is used to define
a structure, a structure is the collection of
variables with a common name. Structure
variables are called fields. A structure is
heterogeneous in that it can be composed
of data of different types. Structure is an
user defined data type.
 Simple structure –
struct Structure_name{
datatype fieldname1;
datatype fieldname2;
………………………;
datatype fieldnamen;
};
The members of a structure are accessed with
the dot (.) operator.
syntax – structure_var_name.fieldname;
: st.rollno;
st.st_name;
st.per_marks;
 In contrast, array is homogeneous since it can
contain only data of the same type.
 Complex data structures can be formed by
defining arrays of structs.
syntax – struct structure_name array_name[i];
For Exa : struct student_type st[50];
Int main()
{
struct student st[50];
int I;
for(i=0;i<5;i++)
{
When a structure whose member also of a
structure type then such structure are called
Nested structure.
Nested are of two types –
1) Separate Structure
2) Embedded Structure
1) : We can create two
structures, but dependent
structure should be used inside the main
structure as a member.
struct date{
int dd;
int mm;
int yyyy;
}doj;
struct employee{
int id;
char name[20];
struct date doj;
}emp1;
2) Embedded Structure : In this structure,
we can define structure
within the structure also.
struct employee{
int id;
char name[20];
struct date{
int dd;
int mm;
int yyyy;
}doj;
}emp1;
Structure with Pointer -
 Pointer variable can point to the address of a structure
variable.
For Exa – struct dog{
char name[10];
char breed[10];
int age;
char colour[10];
}spike;
struct dog my_dog={“tyke”,”Bulldog”, 5, “White”};
struct dog *ptr_dog;
ptr_dog=&spike;
When we want to access member of the
structure through pointer, arrow (->)
operator is used.
For Exa –
ptr_dog->name;
ptr_dog->breed;
Or –
(*ptr_dog).name;
(*ptr_dog).breed;
 For Exa –
struct point{
int x;
int y;
}point;
int main()
{
Point P;
printf(“Enter the coordinates of point”);
input(&P);
output(&P);
}
void input(point *point_ptr)
{
scanf(“%d”,&(point_ptr->x));
scanf(“%d”,&(point_ptr->y));
}
void output(point p)
{
printf(“x coordinate=%d”,p.x);
printf(“y coordinate=%d”,p.y);
}
#Jai c presentation

More Related Content

What's hot

Structure c
Structure cStructure c
Structure c
thirumalaikumar3
 
Structure in c language
Structure in c languageStructure in c language
Structure in c language
sangrampatil81
 
oop Lecture 1
oop Lecture 1oop Lecture 1
oop Lecture 1
Atif Khan
 
Structure in C
Structure in CStructure in C
Structure in C
Fazle Rabbi Ador
 
Programming in C session 3
Programming in C session 3Programming in C session 3
Programming in C session 3
Prerna Sharma
 
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
Smit Shah
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
tanmaymodi4
 
C Structures & Unions
C Structures & UnionsC Structures & Unions
C Structures & Unions
Ram Sagar Mourya
 
Structure in c
Structure in cStructure in c
Structure in c
Samsil Arefin
 
pointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handlingpointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handling
Rai University
 
When to use a structure vs classes in c++
When to use a structure vs classes in c++When to use a structure vs classes in c++
When to use a structure vs classes in c++
Naman Kumar
 
Data Types | CS8251- Programming in c | Learn Hub
Data Types | CS8251- Programming in c | Learn HubData Types | CS8251- Programming in c | Learn Hub
Data Types | CS8251- Programming in c | Learn Hub
Learn Hub
 
C structure and union
C structure and unionC structure and union
C structure and union
Thesis Scientist Private Limited
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and Unions
Ashim Lamichhane
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppteShikshak
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
eShikshak
 

What's hot (20)

Structure c
Structure cStructure c
Structure c
 
Structures
StructuresStructures
Structures
 
Structure in c language
Structure in c languageStructure in c language
Structure in c language
 
oop Lecture 1
oop Lecture 1oop Lecture 1
oop Lecture 1
 
Structure in C
Structure in CStructure in C
Structure in C
 
Programming in C session 3
Programming in C session 3Programming in C session 3
Programming in C session 3
 
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
C Structures & Unions
C Structures & UnionsC Structures & Unions
C Structures & Unions
 
Unit4 C
Unit4 C Unit4 C
Unit4 C
 
Structure in c
Structure in cStructure in c
Structure in c
 
pointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handlingpointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handling
 
When to use a structure vs classes in c++
When to use a structure vs classes in c++When to use a structure vs classes in c++
When to use a structure vs classes in c++
 
Data Types | CS8251- Programming in c | Learn Hub
Data Types | CS8251- Programming in c | Learn HubData Types | CS8251- Programming in c | Learn Hub
Data Types | CS8251- Programming in c | Learn Hub
 
C structure and union
C structure and unionC structure and union
C structure and union
 
Chap 10(structure and unions)
Chap 10(structure and unions)Chap 10(structure and unions)
Chap 10(structure and unions)
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and Unions
 
2 dml
2 dml2 dml
2 dml
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppt
 
Lecture18 structurein c.ppt
Lecture18 structurein c.pptLecture18 structurein c.ppt
Lecture18 structurein c.ppt
 

Similar to #Jai c presentation

Structure In C
Structure In CStructure In C
Structure In C
yndaravind
 
structures_v1.ppt
structures_v1.pptstructures_v1.ppt
structures_v1.ppt
ansariparveen06
 
structures_v1.ppt
structures_v1.pptstructures_v1.ppt
structures_v1.ppt
ParinayWadhwa
 
Unit 5 (1)
Unit 5 (1)Unit 5 (1)
Unit 5 (1)
psaravanan1985
 
User defined data types.pptx
User defined data types.pptxUser defined data types.pptx
User defined data types.pptx
Ananthi Palanisamy
 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
MeghaKulkarni27
 
Chapter4.pptx
Chapter4.pptxChapter4.pptx
Chapter4.pptx
WondimuBantihun1
 
Structure & union
Structure & unionStructure & union
Structure & union
lalithambiga kamaraj
 
Structure.pptx
Structure.pptxStructure.pptx
Structure.pptx
SarowarSuman
 
Chapter 13.1.9
Chapter 13.1.9Chapter 13.1.9
Chapter 13.1.9patcha535
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
Tanmay Modi
 
Structures
StructuresStructures
Structures
DrJasmineBeulahG
 
Unit 1_ADC.pptx
Unit 1_ADC.pptxUnit 1_ADC.pptx
Unit 1_ADC.pptx
Itsbrokenstatus
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++Jeff TUYISHIME
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
Swarup Boro
 
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdfEasy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
sudhakargeruganti
 
Lk module4 structures
Lk module4 structuresLk module4 structures
Lk module4 structures
Krishna Nanda
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
Raj Naik
 

Similar to #Jai c presentation (20)

Structure In C
Structure In CStructure In C
Structure In C
 
structures_v1.ppt
structures_v1.pptstructures_v1.ppt
structures_v1.ppt
 
structures_v1.ppt
structures_v1.pptstructures_v1.ppt
structures_v1.ppt
 
Unit 5 (1)
Unit 5 (1)Unit 5 (1)
Unit 5 (1)
 
User defined data types.pptx
User defined data types.pptxUser defined data types.pptx
User defined data types.pptx
 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
 
Chapter4.pptx
Chapter4.pptxChapter4.pptx
Chapter4.pptx
 
Structure & union
Structure & unionStructure & union
Structure & union
 
Structure.pptx
Structure.pptxStructure.pptx
Structure.pptx
 
Chapter 13.1.9
Chapter 13.1.9Chapter 13.1.9
Chapter 13.1.9
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
 
Structures
StructuresStructures
Structures
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 
Unit 1_ADC.pptx
Unit 1_ADC.pptxUnit 1_ADC.pptx
Unit 1_ADC.pptx
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdfEasy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
 
Lk module4 structures
Lk module4 structuresLk module4 structures
Lk module4 structures
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 

More from JAI BAMORIYA

Victoria memorial presentation
Victoria memorial presentationVictoria memorial presentation
Victoria memorial presentation
JAI BAMORIYA
 
Jai dbms
Jai dbmsJai dbms
Jai dbms
JAI BAMORIYA
 
Jai co ppt
Jai co pptJai co ppt
Jai co ppt
JAI BAMORIYA
 
Online movie tickets
Online movie ticketsOnline movie tickets
Online movie tickets
JAI BAMORIYA
 
Memory &amp; its types presentation1
Memory &amp; its types presentation1Memory &amp; its types presentation1
Memory &amp; its types presentation1
JAI BAMORIYA
 
Isp final presentation
Isp final presentationIsp final presentation
Isp final presentation
JAI BAMORIYA
 

More from JAI BAMORIYA (6)

Victoria memorial presentation
Victoria memorial presentationVictoria memorial presentation
Victoria memorial presentation
 
Jai dbms
Jai dbmsJai dbms
Jai dbms
 
Jai co ppt
Jai co pptJai co ppt
Jai co ppt
 
Online movie tickets
Online movie ticketsOnline movie tickets
Online movie tickets
 
Memory &amp; its types presentation1
Memory &amp; its types presentation1Memory &amp; its types presentation1
Memory &amp; its types presentation1
 
Isp final presentation
Isp final presentationIsp final presentation
Isp final presentation
 

Recently uploaded

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 

Recently uploaded (20)

2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 

#Jai c presentation

  • 1.
  • 2. CONTENTS :  Introduction of structure  Array of structure  Nested structure  Structure with pointer
  • 3. Introduction - In C/C++, struct keyword is used to define a structure, a structure is the collection of variables with a common name. Structure variables are called fields. A structure is heterogeneous in that it can be composed of data of different types. Structure is an user defined data type.
  • 4.  Simple structure – struct Structure_name{ datatype fieldname1; datatype fieldname2; ………………………; datatype fieldnamen; };
  • 5.
  • 6.
  • 7.
  • 8. The members of a structure are accessed with the dot (.) operator. syntax – structure_var_name.fieldname; : st.rollno; st.st_name; st.per_marks;
  • 9.
  • 10.  In contrast, array is homogeneous since it can contain only data of the same type.  Complex data structures can be formed by defining arrays of structs. syntax – struct structure_name array_name[i]; For Exa : struct student_type st[50];
  • 11.
  • 12. Int main() { struct student st[50]; int I; for(i=0;i<5;i++) {
  • 13. When a structure whose member also of a structure type then such structure are called Nested structure. Nested are of two types – 1) Separate Structure 2) Embedded Structure 1) : We can create two structures, but dependent structure should be used inside the main structure as a member.
  • 14. struct date{ int dd; int mm; int yyyy; }doj; struct employee{ int id; char name[20]; struct date doj; }emp1;
  • 15. 2) Embedded Structure : In this structure, we can define structure within the structure also. struct employee{ int id; char name[20]; struct date{ int dd; int mm; int yyyy; }doj; }emp1;
  • 16. Structure with Pointer -  Pointer variable can point to the address of a structure variable. For Exa – struct dog{ char name[10]; char breed[10]; int age; char colour[10]; }spike; struct dog my_dog={“tyke”,”Bulldog”, 5, “White”}; struct dog *ptr_dog; ptr_dog=&spike;
  • 17. When we want to access member of the structure through pointer, arrow (->) operator is used. For Exa – ptr_dog->name; ptr_dog->breed; Or – (*ptr_dog).name; (*ptr_dog).breed;
  • 18.  For Exa – struct point{ int x; int y; }point; int main() { Point P; printf(“Enter the coordinates of point”); input(&P); output(&P); }
  • 19. void input(point *point_ptr) { scanf(“%d”,&(point_ptr->x)); scanf(“%d”,&(point_ptr->y)); } void output(point p) { printf(“x coordinate=%d”,p.x); printf(“y coordinate=%d”,p.y); }