SlideShare a Scribd company logo
1 of 6
DEVRY GSP 215 Week 3 Homework Representing and
Manipulating Information NEW
Check this A+ tutorial guideline at
http://www.homeworkrank.com/gsp-215-devry/gsp-215-
week-3-homework-representing-and-manipulating-
information-updated
For more classes visit
http://www.homeworkrank.com
GSP 215 Week 3 Homework Assignment
Week 3 Homework—Representing and
Manipulating Information
Structures are a mechanism for creating a
data type to aggregate multiple objects
into a single unit. All the components of a
structure are stored in a contiguous
region of memory and a pointer to a
structure is the address of its first byte. To
access the fields of a structure, the
compiler generates code that adds the
appropriate offset to the address of the
structure.
The example on the book on page 242
shows the following structure.
struct rec {
int i;
int j;
int a[3];
int *p;
};
This structure contains four fields: two 4-
byte int's, an array consisting of three 4-
byte int's, and a 4-byte int pointer giving a
total of 24 bytes. j is offset 4 bytes.
0 4 8 16 20
24
i j a[0] a[1] a[2] p
Assuming variable 4 is of type struct rec *
and is in register %edx, the following code
copies element r->i to element r->j.
movl (%edx), %eax // Get r->i
movl %eax, 4(%edx) //Store r->j To store into the field j, the
code adds offset 4 to the address of r
Consider the following structure
declaration containing a structure within
a structure, and answer the following
questions.
struct person{
struct size{
int height;
int weight;
}s;
int *hp;
int games[2];
}person1, person2;
1. How many total bytes does the structure require?
height weight hp games[0] games[1]
2. What are the offsets in bytes of the following fields?
s.height: ______________
hp:_______________
games[1]:______________
3. The compiler generates the following assembly code for
the body of str_init (shown below).
movq 16(%rbp), %rax //Get p1 into
register %rax
movl 4(%rax), %edx //Get p1-
>s.weight store in register %edx
movq 16(%rbp), %rax //Get p1 into
register %rax
movl %edx, (%rax) //Store in p1-
>s.height
movq 16(%rbp), %rax //Get p1 into
register %rax
leaq 4(%rax), %rdx //Compute
address of p1->s.weight in register %rdx
movq 16(%rbp), %rax //Get p1 into
register %rax
movq %rdx, 8(%rax) //Store in p1-
>hp
4. On the basis of this information, fill in the missing
expressions in the code for str_init.
void str_init(person *p1)
{
p1->s.height = _____________;
p1->hp = _________________;
}
5. How would you call str_init with the structperson1 passed
to it?
}
5. How would you call str_init with the structperson1 passed
to it?

More Related Content

What's hot

An adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsAn adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsLikan Patra
 
Data Visualization With R: Introduction
Data Visualization With R: IntroductionData Visualization With R: Introduction
Data Visualization With R: IntroductionRsquared Academy
 
Ee693 sept2014quizgt1
Ee693 sept2014quizgt1Ee693 sept2014quizgt1
Ee693 sept2014quizgt1Gopi Saiteja
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresAmrinder Arora
 
Write a function called float dotproduct (links to an external site.)(float a...
Write a function called float dotproduct (links to an external site.)(float a...Write a function called float dotproduct (links to an external site.)(float a...
Write a function called float dotproduct (links to an external site.)(float a...JenniferBall48
 
Ee693 sept2014quizgt2
Ee693 sept2014quizgt2Ee693 sept2014quizgt2
Ee693 sept2014quizgt2Gopi Saiteja
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashingKrish_ver2
 
Graph Matching
Graph MatchingGraph Matching
Graph Matchinggraphitech
 
Faster persistent data structures through hashing
Faster persistent data structures through hashingFaster persistent data structures through hashing
Faster persistent data structures through hashingJohan Tibell
 
Memory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bitsMemory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bitsSomenath Mukhopadhyay
 
Faster persistent data structures through hashing
Faster persistent data structures through hashingFaster persistent data structures through hashing
Faster persistent data structures through hashingJohan Tibell
 
27.2.9 lab regular expression tutorial
27.2.9 lab   regular expression tutorial27.2.9 lab   regular expression tutorial
27.2.9 lab regular expression tutorialFreddy Buenaño
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comjonhson129
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.comjonhson300
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086mudulin
 
Access intermediate 2010 final project new
Access intermediate 2010 final project newAccess intermediate 2010 final project new
Access intermediate 2010 final project newclscott1
 

What's hot (20)

An adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate recordsAn adaptive algorithm for detection of duplicate records
An adaptive algorithm for detection of duplicate records
 
Data Visualization With R: Introduction
Data Visualization With R: IntroductionData Visualization With R: Introduction
Data Visualization With R: Introduction
 
Ee693 sept2014quizgt1
Ee693 sept2014quizgt1Ee693 sept2014quizgt1
Ee693 sept2014quizgt1
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data Structures
 
Write a function called float dotproduct (links to an external site.)(float a...
Write a function called float dotproduct (links to an external site.)(float a...Write a function called float dotproduct (links to an external site.)(float a...
Write a function called float dotproduct (links to an external site.)(float a...
 
L3
L3L3
L3
 
Ee693 sept2014quizgt2
Ee693 sept2014quizgt2Ee693 sept2014quizgt2
Ee693 sept2014quizgt2
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
 
Complier
ComplierComplier
Complier
 
Graph Matching
Graph MatchingGraph Matching
Graph Matching
 
Data Visualization With R
Data Visualization With RData Visualization With R
Data Visualization With R
 
Faster persistent data structures through hashing
Faster persistent data structures through hashingFaster persistent data structures through hashing
Faster persistent data structures through hashing
 
Memory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bitsMemory layout in C++ vis a-vis polymorphism and padding bits
Memory layout in C++ vis a-vis polymorphism and padding bits
 
Extensible hashing
Extensible hashingExtensible hashing
Extensible hashing
 
Faster persistent data structures through hashing
Faster persistent data structures through hashingFaster persistent data structures through hashing
Faster persistent data structures through hashing
 
27.2.9 lab regular expression tutorial
27.2.9 lab   regular expression tutorial27.2.9 lab   regular expression tutorial
27.2.9 lab regular expression tutorial
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.com
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.com
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086
 
Access intermediate 2010 final project new
Access intermediate 2010 final project newAccess intermediate 2010 final project new
Access intermediate 2010 final project new
 

Similar to Devry gsp 215 week 3 homework representing and manipulating information new

Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.comStokesCope20
 
Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comrobertleew18
 
Gsp 215 Exceptional Education / snaptutorial.com
Gsp 215  Exceptional Education / snaptutorial.comGsp 215  Exceptional Education / snaptutorial.com
Gsp 215 Exceptional Education / snaptutorial.comBaileya55
 
GSP 215 Effective Communication - tutorialrank.com
GSP 215  Effective Communication - tutorialrank.comGSP 215  Effective Communication - tutorialrank.com
GSP 215 Effective Communication - tutorialrank.comBartholomew35
 
GSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.comGSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.comsholingarjosh136
 
Gsp 215 Massive Success / snaptutorial.com
Gsp 215  Massive Success / snaptutorial.comGsp 215  Massive Success / snaptutorial.com
Gsp 215 Massive Success / snaptutorial.comNorrisMistryzo
 
Gsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comGsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comStephenson101
 
GSP 215 Education Organization - snaptutorial.com
GSP 215  Education Organization - snaptutorial.comGSP 215  Education Organization - snaptutorial.com
GSP 215 Education Organization - snaptutorial.comdonaldzs192
 
Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.comHarrisGeorg21
 
GSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comGSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comagathachristie281
 
GSP 215 RANK Education Counseling--gsp215rank.com
 GSP 215 RANK Education Counseling--gsp215rank.com GSP 215 RANK Education Counseling--gsp215rank.com
GSP 215 RANK Education Counseling--gsp215rank.comwilliamwordsworth40
 
GSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comGSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comWindyMiller12
 
GSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comGSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comkopiko85
 
GSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.comGSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.comthomashard64
 
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.comGSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.comRoelofMerwe102
 
GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com KeatonJennings102
 
GSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.comGSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.comclaric119
 
GSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.comGSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.comclaric169
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEWshyamuopten
 

Similar to Devry gsp 215 week 3 homework representing and manipulating information new (20)

Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.com
 
Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.com
 
Gsp 215 Exceptional Education / snaptutorial.com
Gsp 215  Exceptional Education / snaptutorial.comGsp 215  Exceptional Education / snaptutorial.com
Gsp 215 Exceptional Education / snaptutorial.com
 
GSP 215 Effective Communication - tutorialrank.com
GSP 215  Effective Communication - tutorialrank.comGSP 215  Effective Communication - tutorialrank.com
GSP 215 Effective Communication - tutorialrank.com
 
GSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.comGSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.com
 
Gsp 215 Massive Success / snaptutorial.com
Gsp 215  Massive Success / snaptutorial.comGsp 215  Massive Success / snaptutorial.com
Gsp 215 Massive Success / snaptutorial.com
 
Gsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comGsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.com
 
GSP 215 Education Organization - snaptutorial.com
GSP 215  Education Organization - snaptutorial.comGSP 215  Education Organization - snaptutorial.com
GSP 215 Education Organization - snaptutorial.com
 
Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.com
 
GSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comGSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.com
 
GSP 215 RANK Education Counseling--gsp215rank.com
 GSP 215 RANK Education Counseling--gsp215rank.com GSP 215 RANK Education Counseling--gsp215rank.com
GSP 215 RANK Education Counseling--gsp215rank.com
 
GSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.comGSP 215 RANK Education Planning--gsp215rank.com
GSP 215 RANK Education Planning--gsp215rank.com
 
GSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.comGSP 215 RANK Education Counseling -- gsp215rank.com
GSP 215 RANK Education Counseling -- gsp215rank.com
 
GSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.comGSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.com
 
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.comGSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
 
GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com
 
GSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.comGSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.com
 
GSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.comGSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.com
 
Embedded C - Lecture 4
Embedded C - Lecture 4Embedded C - Lecture 4
Embedded C - Lecture 4
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEW
 

More from williamethan912

Uop law 421 final guide new
Uop law 421 final guide newUop law 421 final guide new
Uop law 421 final guide newwilliamethan912
 
Devry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server newDevry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server newwilliamethan912
 
Devry gsp 215 week 7 homework networking commands new
Devry gsp 215 week 7 homework networking commands newDevry gsp 215 week 7 homework networking commands new
Devry gsp 215 week 7 homework networking commands newwilliamethan912
 
Devry gsp 215 week 6 i lab virtual memory new
Devry gsp 215 week 6 i lab virtual memory newDevry gsp 215 week 6 i lab virtual memory new
Devry gsp 215 week 6 i lab virtual memory newwilliamethan912
 
Devry gsp 215 week 5 i lab memory new
Devry gsp 215 week 5 i lab memory newDevry gsp 215 week 5 i lab memory new
Devry gsp 215 week 5 i lab memory newwilliamethan912
 
Fin 592 week 6 team final assignment new
Fin 592 week 6 team final assignment newFin 592 week 6 team final assignment new
Fin 592 week 6 team final assignment newwilliamethan912
 
Fin 592 week 3 team outline new
Fin 592 week 3 team outline newFin 592 week 3 team outline new
Fin 592 week 3 team outline newwilliamethan912
 
Uop fin 590 week 6 fraud at enron materiality
Uop fin 590 week 6 fraud at enron materialityUop fin 590 week 6 fraud at enron materiality
Uop fin 590 week 6 fraud at enron materialitywilliamethan912
 
Uop fin 590 week 6 case study 2 new
Uop fin 590 week 6 case study 2 newUop fin 590 week 6 case study 2 new
Uop fin 590 week 6 case study 2 newwilliamethan912
 
Uop fin 590 week 3 case study 1 new
Uop fin 590 week 3 case study 1 newUop fin 590 week 3 case study 1 new
Uop fin 590 week 3 case study 1 newwilliamethan912
 

More from williamethan912 (11)

Uop law 421 week 3 dq 3
Uop law 421 week 3 dq 3Uop law 421 week 3 dq 3
Uop law 421 week 3 dq 3
 
Uop law 421 final guide new
Uop law 421 final guide newUop law 421 final guide new
Uop law 421 final guide new
 
Devry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server newDevry gsp 215 week 7 i lab networking and a tiny web server new
Devry gsp 215 week 7 i lab networking and a tiny web server new
 
Devry gsp 215 week 7 homework networking commands new
Devry gsp 215 week 7 homework networking commands newDevry gsp 215 week 7 homework networking commands new
Devry gsp 215 week 7 homework networking commands new
 
Devry gsp 215 week 6 i lab virtual memory new
Devry gsp 215 week 6 i lab virtual memory newDevry gsp 215 week 6 i lab virtual memory new
Devry gsp 215 week 6 i lab virtual memory new
 
Devry gsp 215 week 5 i lab memory new
Devry gsp 215 week 5 i lab memory newDevry gsp 215 week 5 i lab memory new
Devry gsp 215 week 5 i lab memory new
 
Fin 592 week 6 team final assignment new
Fin 592 week 6 team final assignment newFin 592 week 6 team final assignment new
Fin 592 week 6 team final assignment new
 
Fin 592 week 3 team outline new
Fin 592 week 3 team outline newFin 592 week 3 team outline new
Fin 592 week 3 team outline new
 
Uop fin 590 week 6 fraud at enron materiality
Uop fin 590 week 6 fraud at enron materialityUop fin 590 week 6 fraud at enron materiality
Uop fin 590 week 6 fraud at enron materiality
 
Uop fin 590 week 6 case study 2 new
Uop fin 590 week 6 case study 2 newUop fin 590 week 6 case study 2 new
Uop fin 590 week 6 case study 2 new
 
Uop fin 590 week 3 case study 1 new
Uop fin 590 week 3 case study 1 newUop fin 590 week 3 case study 1 new
Uop fin 590 week 3 case study 1 new
 

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
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
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
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
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
 
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
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 

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
 
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
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
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
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
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
 
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
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 

Devry gsp 215 week 3 homework representing and manipulating information new

  • 1. DEVRY GSP 215 Week 3 Homework Representing and Manipulating Information NEW Check this A+ tutorial guideline at http://www.homeworkrank.com/gsp-215-devry/gsp-215- week-3-homework-representing-and-manipulating- information-updated For more classes visit http://www.homeworkrank.com GSP 215 Week 3 Homework Assignment Week 3 Homework—Representing and Manipulating Information Structures are a mechanism for creating a data type to aggregate multiple objects into a single unit. All the components of a structure are stored in a contiguous region of memory and a pointer to a structure is the address of its first byte. To access the fields of a structure, the compiler generates code that adds the appropriate offset to the address of the structure. The example on the book on page 242 shows the following structure.
  • 2. struct rec { int i; int j; int a[3]; int *p; }; This structure contains four fields: two 4- byte int's, an array consisting of three 4- byte int's, and a 4-byte int pointer giving a total of 24 bytes. j is offset 4 bytes. 0 4 8 16 20 24 i j a[0] a[1] a[2] p Assuming variable 4 is of type struct rec * and is in register %edx, the following code copies element r->i to element r->j. movl (%edx), %eax // Get r->i movl %eax, 4(%edx) //Store r->j To store into the field j, the code adds offset 4 to the address of r Consider the following structure declaration containing a structure within a structure, and answer the following questions.
  • 3. struct person{ struct size{ int height; int weight; }s; int *hp; int games[2]; }person1, person2; 1. How many total bytes does the structure require? height weight hp games[0] games[1] 2. What are the offsets in bytes of the following fields? s.height: ______________ hp:_______________ games[1]:______________ 3. The compiler generates the following assembly code for the body of str_init (shown below).
  • 4. movq 16(%rbp), %rax //Get p1 into register %rax movl 4(%rax), %edx //Get p1- >s.weight store in register %edx movq 16(%rbp), %rax //Get p1 into register %rax movl %edx, (%rax) //Store in p1- >s.height movq 16(%rbp), %rax //Get p1 into register %rax leaq 4(%rax), %rdx //Compute address of p1->s.weight in register %rdx movq 16(%rbp), %rax //Get p1 into register %rax movq %rdx, 8(%rax) //Store in p1- >hp 4. On the basis of this information, fill in the missing expressions in the code for str_init. void str_init(person *p1) { p1->s.height = _____________; p1->hp = _________________;
  • 5. } 5. How would you call str_init with the structperson1 passed to it?
  • 6. } 5. How would you call str_init with the structperson1 passed to it?