SlideShare uma empresa Scribd logo
1 de 33
CHAPTER 7: STRUCTURES
Outline: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
7.1 Introduction ,[object Object],[object Object],[object Object],[object Object]
7.2 Defining a Structure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],struct  tag  { member1 ; member2 ; ... memberN ; };
7.2 Defining a Structure – cont’1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
7.2 Defining a Structure – cont’2 ,[object Object],[object Object],[object Object],[object Object],struct custAccount  { int accNo; char accType; char name[80]; float accBalance; }; struct custAccount oldcust, newcust;
7.2 Defining a Structure – cont’3 ,[object Object],struct custAccount  { int accNo; char accType; char name[80]; float accBalance; } oldcust, newcust;
7.2 Defining a Structure – cont’4 ,[object Object],struct date { int month; int day; int year; }; struct custAccount { int accNo; char accType; char name[80]; float accBalance; struct date payment; } oldcust, newcust; ,[object Object],[object Object]
7.2 Defining a Structure – cont’5
7.3 Defining using  typedef ,[object Object],[object Object],[object Object]
7.3 Defining using  typedef  - cont’1 ,[object Object],[object Object],[object Object]
7.3 Defining using  typedef  - cont’2 ,[object Object],typedef struct  { member1; member2; ...; memberN; } new_type  ,[object Object],[object Object]
7.3 Defining using  typedef  - cont’3 ,[object Object],typedef struct { int accNo; char accType; char name[80]; float accBalance; } record; record oldcust, newcust; ,[object Object],[object Object]
7.3 Defining using  typedef  - cont’3 ,[object Object],[object Object],[object Object],[object Object],typedef struct { int month; int day; int year; } date; typedef struct { int accNo; char accType; char name[80]; float accBalance; date payment; } record; record cust[100];
7.3 Defining using  typedef  - cont’4 ,[object Object],typedef struct { int month; int day; int year; } date; typedef struct { int accNo; char accType; char name[80]; float accBalance; date payment; } record[100]; record cust; typedef struct { int month; int day; int year; } date; struct { int accNo; char accType; char name[80]; float accBalance; date payment; } cust[100];
7.4 Structure Members ,[object Object],[object Object],variable.member variables’ name act as a separator members’ name
7.4 Structure Members  - cont’1 ,[object Object],struct date { int month; int day; int year; }; struct custAccount{ int accNo; char accType; char name[80]; float accBalance; struct date payment; } cust; Example: To access the info. of cust. /* to access the customer’s */ /* account no. */ cust.accNo /* to access the customer’s */ /* name */ cust.name cust.name[2] &cust.name[2] /* to access the month of */ /* the payment of customer */ cust.payment.month
7.5 Initializing Structures ,[object Object],[object Object]
7.5 Initializing Structures – cont’1 ,[object Object],storage_class struct tag variable = {value1, value2, ..., valueN};  Refer to the value of corresponding structure members auto, extern, register, static
7.5 Initializing Structures – cont’1 struct date { int month; int day; int year; }; struct custAccount { int accNo; char accType; char name[80]; float accBalance; struct date payment; }; static  struct custAccount cust= {2345,‘S’,“Khadijah Ismail”,2400.90,9,7,2006}; : Example 7.9
7.5 Initializing Structures – cont’2 Example 7.10:
7.6 Nested Stuctures ,[object Object],[object Object]
7.6 Nested Structures – cont’1 struct employees{ char empName[25]; char  address[30] ; char  city [10] ; char  state[2] ; long int  poscode ; double salary; }; struct customers{ char custName[25]; char  address[30] ; char  city [10] ; char  state[2] ; long int  poscode ; double balance; }; struct addressInfo{ char address[30]; char city [10]; char state[2]; long int poscode; }; struct employees{ char empName[25]; struct addressInfo eAddress; double salary; }e1; struct customers{ char custName[25]; struct addressInfo cAddress; double balance; }c1; Example 7.12: :Example 7.13
7.7 Arrays of Structures ,[object Object],struct date { int month; int day; int year; }; struct custAccount{ int accNo; char accType; char name[80]; float accBalance; struct date payment; } cust[200]; struct date { int month; int day; int year; }; struct custAccount{ int accNo; char accType; char name[80]; float accBalance; struct date payment; }; struct custAccount cust[200]; OR
7.7 Arrays of Structures – cont’2 Example 7.16
7.7 Arrays of Structures – cont’1 ,[object Object],struct student { char name[80]; float courseMark; float finalMark; int TotMark; }; static struct student MarkList[ ] = { “ Kadir”, 45.50, 30.00, 76, "Azizan", 43.50, 30.00, 73, "Xavier", 44.50, 30.00, 75, "Nantha", 46.50, 30.00, 77, "Junani", 42.50, 30.00, 73, "Martha", 42.00, 30.00, 72 } ;
7.8 Structures and Pointers ,[object Object],struct name *ptr ; ,[object Object],struct PersonalData *ptr ; (*ptr).YearOfBirth=20 ; struct PersonalData *ptr ; ptr -> YearOfBirth=20 ; OR
7.8 Structures and Pointers – cont’1 Example 7.16: Example 7.17:
7.9 Passing Structures to Func ,[object Object],[object Object],[object Object]
7.9 Passing Structures … – cont’1 ,[object Object],[object Object],[object Object],[object Object]
7.9 Passing Structures … – cont’2 ,[object Object],[object Object]
7.9 Passing Structures … – cont’3 ,[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados (20)

Resource wrappers in C++
Resource wrappers in C++Resource wrappers in C++
Resource wrappers in C++
 
Module 1:Introduction
Module 1:IntroductionModule 1:Introduction
Module 1:Introduction
 
Pointers
PointersPointers
Pointers
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Module 5-Structure and Union
Module 5-Structure and UnionModule 5-Structure and Union
Module 5-Structure and Union
 
C Prog - Pointers
C Prog - PointersC Prog - Pointers
C Prog - Pointers
 
Structure & union
Structure & unionStructure & union
Structure & union
 
Module 4- Arrays and Strings
Module 4- Arrays and StringsModule 4- Arrays and Strings
Module 4- Arrays and Strings
 
COM1407: Working with Pointers
COM1407: Working with PointersCOM1407: Working with Pointers
COM1407: Working with Pointers
 
C pointer
C pointerC pointer
C pointer
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
 
Pointers in C Programming
Pointers in C ProgrammingPointers in C Programming
Pointers in C Programming
 
Pointer in C
Pointer in CPointer in C
Pointer in C
 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
Pointers & References in C++
Pointers & References in C++Pointers & References in C++
Pointers & References in C++
 
Advanced Programming C++
Advanced Programming C++Advanced Programming C++
Advanced Programming C++
 
Pointer in C
Pointer in CPointer in C
Pointer in C
 
C pointer basics
C pointer basicsC pointer basics
C pointer basics
 
C programming session 04
C programming session 04C programming session 04
C programming session 04
 

Destaque (20)

Structures in c++
Structures in c++Structures in c++
Structures in c++
 
Ch8 file processing
Ch8 file processingCh8 file processing
Ch8 file processing
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Ch3 selection
Ch3 selectionCh3 selection
Ch3 selection
 
9 lan
9 lan9 lan
9 lan
 
10 high speedla-ns
10 high speedla-ns10 high speedla-ns
10 high speedla-ns
 
13 atm
13 atm13 atm
13 atm
 
Ch1 principles of software development
Ch1 principles of software developmentCh1 principles of software development
Ch1 principles of software development
 
6 data linkcontrol
6  data linkcontrol6  data linkcontrol
6 data linkcontrol
 
8 spread spectrum
8 spread spectrum8 spread spectrum
8 spread spectrum
 
5 digital datacomm
5 digital datacomm5 digital datacomm
5 digital datacomm
 
12 wireless la-ns
12 wireless la-ns12 wireless la-ns
12 wireless la-ns
 
AM Receivers
AM ReceiversAM Receivers
AM Receivers
 
11 circuit-packet
11 circuit-packet11 circuit-packet
11 circuit-packet
 
Types of AM Receiver
Types of AM Receiver Types of AM Receiver
Types of AM Receiver
 
Chapter 3 am receivers
Chapter 3 am receiversChapter 3 am receivers
Chapter 3 am receivers
 
4 signal encodingtechniques
4 signal encodingtechniques4 signal encodingtechniques
4 signal encodingtechniques
 
7 multiplexing
7 multiplexing7 multiplexing
7 multiplexing
 
Chapter 2 amplitude_modulation
Chapter 2 amplitude_modulationChapter 2 amplitude_modulation
Chapter 2 amplitude_modulation
 
Protocolos- SMTP, POP3 e IMAP4
Protocolos- SMTP, POP3 e IMAP4Protocolos- SMTP, POP3 e IMAP4
Protocolos- SMTP, POP3 e IMAP4
 

Semelhante a Ch7 structures

CHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptxCHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptxGebruGetachew2
 
Structure in c language
Structure in c languageStructure in c language
Structure in c languagesangrampatil81
 
Pointers and Structures
Pointers and StructuresPointers and Structures
Pointers and StructuresGem WeBlog
 
Cs1123 12 structures
Cs1123 12 structuresCs1123 12 structures
Cs1123 12 structuresTAlha MAlik
 
Data Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self ReferentialData Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self Referentialbabuk110
 
FP 201 - Unit4 Part 2
FP 201 - Unit4 Part 2FP 201 - Unit4 Part 2
FP 201 - Unit4 Part 2rohassanie
 
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.pdfsudhakargeruganti
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfTamiratDejene1
 
data structure and c programing concepts
data structure and c programing conceptsdata structure and c programing concepts
data structure and c programing conceptskavitham66441
 
slideset 7 structure and union (1).pdf
slideset 7 structure and union (1).pdfslideset 7 structure and union (1).pdf
slideset 7 structure and union (1).pdfHimanshuKansal22
 
Structure In C
Structure In CStructure In C
Structure In Cyndaravind
 
Structures
StructuresStructures
Structuresselvapon
 

Semelhante a Ch7 structures (20)

9.structure & union
9.structure & union9.structure & union
9.structure & union
 
CHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptxCHAPTER -4-class and structure.pptx
CHAPTER -4-class and structure.pptx
 
12Structures.pptx
12Structures.pptx12Structures.pptx
12Structures.pptx
 
structure.ppt
structure.pptstructure.ppt
structure.ppt
 
Structure in c language
Structure in c languageStructure in c language
Structure in c language
 
structure .pptx
structure .pptxstructure .pptx
structure .pptx
 
Pointers and Structures
Pointers and StructuresPointers and Structures
Pointers and Structures
 
Cs1123 12 structures
Cs1123 12 structuresCs1123 12 structures
Cs1123 12 structures
 
structure1.pdf
structure1.pdfstructure1.pdf
structure1.pdf
 
Data Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self ReferentialData Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self Referential
 
FP 201 - Unit4 Part 2
FP 201 - Unit4 Part 2FP 201 - Unit4 Part 2
FP 201 - Unit4 Part 2
 
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
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdf
 
data structure and c programing concepts
data structure and c programing conceptsdata structure and c programing concepts
data structure and c programing concepts
 
Unit 5 (1)
Unit 5 (1)Unit 5 (1)
Unit 5 (1)
 
Lab 13
Lab 13Lab 13
Lab 13
 
C structure and union
C structure and unionC structure and union
C structure and union
 
slideset 7 structure and union (1).pdf
slideset 7 structure and union (1).pdfslideset 7 structure and union (1).pdf
slideset 7 structure and union (1).pdf
 
Structure In C
Structure In CStructure In C
Structure In C
 
Structures
StructuresStructures
Structures
 

Mais de Hattori Sidek

Chapter 4 frequency modulation
Chapter 4 frequency modulationChapter 4 frequency modulation
Chapter 4 frequency modulationHattori Sidek
 
3. transmission media
3. transmission media3. transmission media
3. transmission mediaHattori Sidek
 
2[1].1 data transmission
2[1].1 data transmission2[1].1 data transmission
2[1].1 data transmissionHattori Sidek
 
14 congestionin datanetworks
14 congestionin datanetworks14 congestionin datanetworks
14 congestionin datanetworksHattori Sidek
 
Chapter 6 dc motor speed control
Chapter 6 dc motor speed controlChapter 6 dc motor speed control
Chapter 6 dc motor speed controlHattori Sidek
 

Mais de Hattori Sidek (10)

Chapter 4 frequency modulation
Chapter 4 frequency modulationChapter 4 frequency modulation
Chapter 4 frequency modulation
 
3. transmission media
3. transmission media3. transmission media
3. transmission media
 
2[1].1 data transmission
2[1].1 data transmission2[1].1 data transmission
2[1].1 data transmission
 
14 congestionin datanetworks
14 congestionin datanetworks14 congestionin datanetworks
14 congestionin datanetworks
 
01 pengenalan
01 pengenalan01 pengenalan
01 pengenalan
 
01 berkenalan
01 berkenalan01 berkenalan
01 berkenalan
 
Comm introduction
Comm introductionComm introduction
Comm introduction
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
Chapter 6 edit
Chapter 6 editChapter 6 edit
Chapter 6 edit
 
Chapter 6 dc motor speed control
Chapter 6 dc motor speed controlChapter 6 dc motor speed control
Chapter 6 dc motor speed control
 

Último

PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfSanaAli374401
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 

Último (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 

Ch7 structures

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. 7.2 Defining a Structure – cont’5
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. 7.5 Initializing Structures – cont’1 struct date { int month; int day; int year; }; struct custAccount { int accNo; char accType; char name[80]; float accBalance; struct date payment; }; static struct custAccount cust= {2345,‘S’,“Khadijah Ismail”,2400.90,9,7,2006}; : Example 7.9
  • 22. 7.5 Initializing Structures – cont’2 Example 7.10:
  • 23.
  • 24. 7.6 Nested Structures – cont’1 struct employees{ char empName[25]; char address[30] ; char city [10] ; char state[2] ; long int poscode ; double salary; }; struct customers{ char custName[25]; char address[30] ; char city [10] ; char state[2] ; long int poscode ; double balance; }; struct addressInfo{ char address[30]; char city [10]; char state[2]; long int poscode; }; struct employees{ char empName[25]; struct addressInfo eAddress; double salary; }e1; struct customers{ char custName[25]; struct addressInfo cAddress; double balance; }c1; Example 7.12: :Example 7.13
  • 25.
  • 26. 7.7 Arrays of Structures – cont’2 Example 7.16
  • 27.
  • 28.
  • 29. 7.8 Structures and Pointers – cont’1 Example 7.16: Example 7.17:
  • 30.
  • 31.
  • 32.
  • 33.