SlideShare a Scribd company logo
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: Introduction
Rsquared Academy
 
Ee693 sept2014quizgt1
Ee693 sept2014quizgt1Ee693 sept2014quizgt1
Ee693 sept2014quizgt1
Gopi Saiteja
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data Structures
Amrinder 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
 
L3
L3L3
L3
lksoo
 
Ee693 sept2014quizgt2
Ee693 sept2014quizgt2Ee693 sept2014quizgt2
Ee693 sept2014quizgt2
Gopi Saiteja
 
4.4 external hashing
4.4 external hashing4.4 external hashing
4.4 external hashing
Krish_ver2
 
Complier
ComplierComplier
Complier
Anbu Alagan
 
Graph Matching
Graph MatchingGraph Matching
Graph Matching
graphitech
 
Data Visualization With R
Data Visualization With RData Visualization With R
Data Visualization With R
Rsquared Academy
 
Faster persistent data structures through hashing
Faster persistent data structures through hashingFaster persistent data structures through hashing
Faster persistent data structures through hashing
Johan 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 bits
Somenath Mukhopadhyay
 
Extensible hashing
Extensible hashingExtensible hashing
Extensible hashing
rajshreemuthiah
 
Faster persistent data structures through hashing
Faster persistent data structures through hashingFaster persistent data structures through hashing
Faster persistent data structures through hashing
Johan 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 tutorial
Freddy Buenaño
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.com
jonhson129
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.com
jonhson300
 
Instruction set-of-8086
Instruction set-of-8086Instruction set-of-8086
Instruction set-of-8086
mudulin
 
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.com
StokesCope20
 
Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.com
robertleew18
 
Gsp 215 Exceptional Education / snaptutorial.com
Gsp 215  Exceptional Education / snaptutorial.comGsp 215  Exceptional Education / snaptutorial.com
Gsp 215 Exceptional Education / snaptutorial.com
Baileya55
 
GSP 215 Effective Communication - tutorialrank.com
GSP 215  Effective Communication - tutorialrank.comGSP 215  Effective Communication - tutorialrank.com
GSP 215 Effective Communication - tutorialrank.com
Bartholomew35
 
Gsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comGsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.com
Stephenson101
 
Gsp 215 Massive Success / snaptutorial.com
Gsp 215  Massive Success / snaptutorial.comGsp 215  Massive Success / snaptutorial.com
Gsp 215 Massive Success / snaptutorial.com
NorrisMistryzo
 
GSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.comGSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.com
sholingarjosh136
 
GSP 215 Education Organization - snaptutorial.com
GSP 215  Education Organization - snaptutorial.comGSP 215  Education Organization - snaptutorial.com
GSP 215 Education Organization - snaptutorial.com
donaldzs192
 
Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.com
HarrisGeorg21
 
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
agathachristie281
 
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
williamwordsworth40
 
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
WindyMiller12
 
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
kopiko85
 
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
thomashard64
 
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
RoelofMerwe102
 
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.com
claric119
 
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
claric169
 
Embedded C - Lecture 4
Embedded C - Lecture 4Embedded C - Lecture 4
Embedded C - Lecture 4
Mohamed Abdallah
 
GSP 215 Entire Course NEW
GSP 215 Entire Course NEWGSP 215 Entire Course NEW
GSP 215 Entire Course NEW
shyamuopten
 

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 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comGsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / 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 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.comGSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--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 week 3 dq 3
Uop law 421 week 3 dq 3Uop law 421 week 3 dq 3
Uop law 421 week 3 dq 3
williamethan912
 
Uop law 421 final guide new
Uop law 421 final guide newUop law 421 final guide new
Uop law 421 final guide new
williamethan912
 
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
williamethan912
 
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
williamethan912
 
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
williamethan912
 
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
williamethan912
 
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
williamethan912
 
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
williamethan912
 
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
williamethan912
 
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
williamethan912
 
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
williamethan912
 

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

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
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
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
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
 
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
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
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
 
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
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 

Recently uploaded (20)

Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
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
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
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
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
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
 
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
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).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?