Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3: Pointers (10 pt) What is the value of a, b, c_ptr at the end of each program. Give N/A if a value is

Question 3: Pointers (10 pt)

What is the value of a, b, c_ptr at the end of each program. Give N/A if a value is undefined. It is recommended that you practices drawing a memory map for solving these questions.

Assume the following memory locations for the variables:

- Location of a is 0xFFFF_FF00

- Location of b is 0xFFFF_FE00

- Location of c_ptr is 0xFFFF_FD00

a. 3pts

void main()

{

char a = 5;

char b = 10;

char *c_ptr;

c_ptr = &a;

*c_ptr = 12;

*c_ptr = b;

c_ptr = &b;

*c_ptr = a;

}

a is ______ b is __________ c_ptr is ___________ .

b. 3pts

void main()

{

char a = 5;

char b = 10;

char *c_ptr = 0;

c_ptr = &a;

c_ptr = &b;

(*c_ptr)++;

c_ptr++;

}

a is ______ b is _____ c_ptr is ________

c. 4pts (note all variables were changed from chars to ints or pointers to ints).

void main()

{

int a = 5;

int b = 10;

int *c_ptr = 0;

c_ptr = &b;

a = *c_ptr + b;

(*c_ptr)++;

c_ptr++;

}

a is ________ b is _________ c_ptr is ________

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

5. What is all of this costing our organization/my department?

Answered: 1 week ago

Question

Question What are the advantages of a written bonus plan?

Answered: 1 week ago