SlideShare a Scribd company logo
1 of 13
STRUCTURE
INTRODUCTION OF STRUCTURE: -
Structure is the collection of variables of different types under a single name
for better handling.
For example:
You want to store the information about person about his/her name,
citizenship number and salary. You can create these information separately but,
approach will be collection of these information under single name because all these
information are related to person.
STRUCTURE DEFINE IN C
A structure is a collection of multiple data types that can be referenced with single
name.it may contain similar or different types.
The data items in a structure are called structure elements, members or fields.
Uses of Structures 
The structure are used to defined new data types.
The users can defined a new data type that may contain different types of data .
A simple variable can store only one value at a time. But a structure variable can store
values at the time.
Difference between array and structure:
The difference between an array and structure is that array consists of a set of
variables of same data type . However, a structure may consist of different data type.
DECLARING A STRUCTURE
A structure is declared by using the keyword struct followed by the structure name.
The structure members are defined with their type inside the opening and closing
braces { }.
The closing braces is ended with a semicolon.
The Declaration tells the compiler about the details of the structure .the complier
does not allocate any memory.
The structure is also called “Structure specifier”
Syntax of declaring a structure :-
Struct struct_name
{
Data_Type1 identifier1;
Data_type2 identifier2;
:
:
};
Example of declares of structure :
Struct student
{
int Rollno, Marks;
float Average;
char Grade;
};
The above structure contains four member variables. The above declaration has
created a new data type student.
A variable of type student store four values at one time.
STRUCTURE VARIABLE
The structure variable can be defined after the declaration of a structure.
Structure variable is same as defined a variable of basic types such as Int and Char.
Syntax of variable structure
Struct_Name identifier;
Struct_Name is the name of the structure
Identifier is the name of variable to be defined
Example:
#include<iostream>
using namespace std;
struct student
{
int rollno;
string name;
string cls;
};
int main()
{
student x;
cout<<"Enter your rollno.";
cin>>x.rollno;
cout<<"Enter your name.";
cin>>x.name;
cout<<"Enter your cls.";
cin>>x.cls;
cout<<x.rollno" "<<x.name" "<<x.cls;
}
#include<iostream>
using namespace std;
struct student
{
int rollno;
string name;
string cls;
};
int main()
{
student s[3];
for(int i=0;i<=2;i++)
{
cin>>s[i].rollno>>s[i].name>>s[i].cls;
}
for(int i=0; i<=2; i++)
{
cout<<s[i].rollno<<" "<<s[i].name<<" "<<s[i].cls;
}
}
Structure prespentation

More Related Content

What's hot

What's hot (20)

C Structures & Unions
C Structures & UnionsC Structures & Unions
C Structures & Unions
 
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...
 
CPU : Structures And Unions
CPU : Structures And UnionsCPU : Structures And Unions
CPU : Structures And Unions
 
Union In language C
Union In language CUnion In language C
Union In language C
 
Unit4 C
Unit4 C Unit4 C
Unit4 C
 
Introduction linked list
Introduction linked listIntroduction linked list
Introduction linked list
 
What is Non-primitive data type?
What is Non-primitive data type?What is Non-primitive data type?
What is Non-primitive data type?
 
Lk module4 structures
Lk module4 structuresLk module4 structures
Lk module4 structures
 
Union in C programming
Union in C programmingUnion in C programming
Union in C programming
 
struct and class deferences
 struct and class deferences struct and class deferences
struct and class deferences
 
17 structure-and-union
17 structure-and-union17 structure-and-union
17 structure-and-union
 
User defined data type
User defined data typeUser defined data type
User defined data type
 
Structure & Union in C++
Structure & Union in C++Structure & Union in C++
Structure & Union in C++
 
Str
StrStr
Str
 
Impquest2
Impquest2Impquest2
Impquest2
 
Differences between structure and class
Differences between structure and classDifferences between structure and class
Differences between structure and class
 
Introduction of structure (2)
Introduction of structure (2)Introduction of structure (2)
Introduction of structure (2)
 
Chap 13(dynamic memory allocation)
Chap 13(dynamic memory allocation)Chap 13(dynamic memory allocation)
Chap 13(dynamic memory allocation)
 
Data structures
Data structuresData structures
Data structures
 
Unions in c
Unions in cUnions in c
Unions in c
 

Viewers also liked (8)

Assistência apple
Assistência appleAssistência apple
Assistência apple
 
Lacoste lookbook
Lacoste lookbookLacoste lookbook
Lacoste lookbook
 
Assistencia apple
Assistencia appleAssistencia apple
Assistencia apple
 
ashraf
ashrafashraf
ashraf
 
Activida 3
Activida 3Activida 3
Activida 3
 
Turkey ppt
Turkey pptTurkey ppt
Turkey ppt
 
Rudy Bueno_CV
Rudy Bueno_CVRudy Bueno_CV
Rudy Bueno_CV
 
Historia de la edad contemporanea
Historia de la edad contemporaneaHistoria de la edad contemporanea
Historia de la edad contemporanea
 

Similar to Structure prespentation

Similar to Structure prespentation (20)

Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
Chapter 13.1.9
Chapter 13.1.9Chapter 13.1.9
Chapter 13.1.9
 
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdfSTRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
STRUCTURE AND UNION IN C MRS.SOWMYA JYOTHI.pdf
 
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++
 
structure and union1.pdf
structure and union1.pdfstructure and union1.pdf
structure and union1.pdf
 
Structure.pptx
Structure.pptxStructure.pptx
Structure.pptx
 
Unit 1_ADC.pptx
Unit 1_ADC.pptxUnit 1_ADC.pptx
Unit 1_ADC.pptx
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 
Chapter4.pptx
Chapter4.pptxChapter4.pptx
Chapter4.pptx
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 
C UNIT-4 PREPARED BY M V BRAHMANANDA RE
C UNIT-4 PREPARED BY M V BRAHMANANDA REC UNIT-4 PREPARED BY M V BRAHMANANDA RE
C UNIT-4 PREPARED BY M V BRAHMANANDA RE
 
Structure & union
Structure & unionStructure & union
Structure & union
 
C structure and union
C structure and unionC structure and union
C structure and union
 
DS_PPT.ppt
DS_PPT.pptDS_PPT.ppt
DS_PPT.ppt
 
structures_v1.ppt
structures_v1.pptstructures_v1.ppt
structures_v1.ppt
 
structures_v1.ppt
structures_v1.pptstructures_v1.ppt
structures_v1.ppt
 
Structure and Typedef
Structure and TypedefStructure and Typedef
Structure and Typedef
 
C Structures and Unions
C Structures and UnionsC Structures and Unions
C Structures and Unions
 
Chapter15 structure
Chapter15 structureChapter15 structure
Chapter15 structure
 

Recently uploaded

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsKarinaGenton
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 

Recently uploaded (20)

How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Science 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its CharacteristicsScience 7 - LAND and SEA BREEZE and its Characteristics
Science 7 - LAND and SEA BREEZE and its Characteristics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 

Structure prespentation

  • 1.
  • 3. INTRODUCTION OF STRUCTURE: - Structure is the collection of variables of different types under a single name for better handling. For example: You want to store the information about person about his/her name, citizenship number and salary. You can create these information separately but, approach will be collection of these information under single name because all these information are related to person.
  • 4. STRUCTURE DEFINE IN C A structure is a collection of multiple data types that can be referenced with single name.it may contain similar or different types. The data items in a structure are called structure elements, members or fields.
  • 5. Uses of Structures  The structure are used to defined new data types. The users can defined a new data type that may contain different types of data . A simple variable can store only one value at a time. But a structure variable can store values at the time. Difference between array and structure: The difference between an array and structure is that array consists of a set of variables of same data type . However, a structure may consist of different data type.
  • 6. DECLARING A STRUCTURE A structure is declared by using the keyword struct followed by the structure name. The structure members are defined with their type inside the opening and closing braces { }. The closing braces is ended with a semicolon. The Declaration tells the compiler about the details of the structure .the complier does not allocate any memory. The structure is also called “Structure specifier”
  • 7. Syntax of declaring a structure :- Struct struct_name { Data_Type1 identifier1; Data_type2 identifier2; : : };
  • 8. Example of declares of structure : Struct student { int Rollno, Marks; float Average; char Grade; }; The above structure contains four member variables. The above declaration has created a new data type student. A variable of type student store four values at one time.
  • 9. STRUCTURE VARIABLE The structure variable can be defined after the declaration of a structure. Structure variable is same as defined a variable of basic types such as Int and Char.
  • 10. Syntax of variable structure Struct_Name identifier; Struct_Name is the name of the structure Identifier is the name of variable to be defined
  • 11. Example: #include<iostream> using namespace std; struct student { int rollno; string name; string cls; }; int main() { student x; cout<<"Enter your rollno."; cin>>x.rollno; cout<<"Enter your name."; cin>>x.name; cout<<"Enter your cls."; cin>>x.cls; cout<<x.rollno" "<<x.name" "<<x.cls; }
  • 12. #include<iostream> using namespace std; struct student { int rollno; string name; string cls; }; int main() { student s[3]; for(int i=0;i<=2;i++) { cin>>s[i].rollno>>s[i].name>>s[i].cls; } for(int i=0; i<=2; i++) { cout<<s[i].rollno<<" "<<s[i].name<<" "<<s[i].cls; } }