
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
![Q.4 A pointer is a variable whose value is the address of another variable, i.e., direct address
of the memory location. Given the C code and memory content mapping shown in
Figure Q.4, complete the Table Q.4 to predict the value after program execution.
RAM
#include <stdio.h>
void calculate_average(char mark[], float "average, int size)
0x0010 0000
{
for (int i=0; i< size; i++)
{
*average = "average + mark[i];
0x0020 0000
average_mark
}
"average = "average / size;
0x0030 0000
ptr
FLY
int main()
{
0x0040 0000
mark[0]
char mark[5]=(50, 80, 95, 34, 99};
float average_mark = 0;
mark[1]
float *ptr=&average_mark;
calculate_average(mark, ptr, 5);
mark[2]
mark[3]
return 0;
mark[4]
Figure Q.4
Table Q.4
Variable
Value
a) ptr
b) &ptr
c) *ptr
d) &mark[2]
e) average_mark](https://content.bartleby.com/qna-images/question/2c1d8adf-5b02-4c85-96d6-dc8d33317672/9913a7e6-f54b-403b-83a1-b8309e6fd397/1j1feqr_thumbnail.jpeg)
Transcribed Image Text:Q.4 A pointer is a variable whose value is the address of another variable, i.e., direct address
of the memory location. Given the C code and memory content mapping shown in
Figure Q.4, complete the Table Q.4 to predict the value after program execution.
RAM
#include <stdio.h>
void calculate_average(char mark[], float "average, int size)
0x0010 0000
{
for (int i=0; i< size; i++)
{
*average = "average + mark[i];
0x0020 0000
average_mark
}
"average = "average / size;
0x0030 0000
ptr
FLY
int main()
{
0x0040 0000
mark[0]
char mark[5]=(50, 80, 95, 34, 99};
float average_mark = 0;
mark[1]
float *ptr=&average_mark;
calculate_average(mark, ptr, 5);
mark[2]
mark[3]
return 0;
mark[4]
Figure Q.4
Table Q.4
Variable
Value
a) ptr
b) &ptr
c) *ptr
d) &mark[2]
e) average_mark
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- In the C programming language, a pointer is used to store the ADDRESS of a data value. True Falsearrow_forwardSegmentation: Select all of the following statements that are true. In segmentation, a logical address always has a length of 32 bit. In order to translate logical into physical addresses, the memory management unit uses the segment part of the logical address to determine the start address in the segment table and adds the offset to this to get the physical address. In segmentation, the logical address consists of a segment part and an offset. The segment length is limited by the maximum possible segment number. When applying segmentation, processes are only allowed to access the memory within their segments. Segments can be assigned access rights and privilege levels.arrow_forwardAssembly language Part 1: When a variable is stored in memory, it is associated with an address. To obtain the address of a variable, the & operator can be used. Write a C program addressOfScalar.c by inserting the code below in the main function. Questions: 1) Run the C program, attach a screenshot of the output in the answer sheet. 2) Attach the source code in the answer sheet 3) Then explain why the address after intvar is incremented by 4 bytes instead of 1 byte.arrow_forward
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education