Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please print out this page, and then next to each statement, starting with the statement (x=a), please draw the array and the pointers involved in

Please print out this page, and then next to each statement, starting with the statement (x=a), please draw the array and the pointers involved in that statement to the right of the statement. Please don't run this program and copy the outputs. I want to make sure you do this by hand for every statement. For the printf statements, just write the values of the variables being printed to the right of the statement. This will give you practice for doing pointer arithmetic.

example:

image text in transcribed

What to submit: Scan your handwritten work of this page and upload a PDF of this that clearly shows the pointers and the arrays involved to the right of each statement. Note that some statements have multiple arrays and pointers involved, so draw all of them to the right of the statement. Make sure you clearly show which pointer is pointing to which array element as shown in image above for the statement z=&b[2].

int *x, *y, *z, *a, *c, b[3] = {-4, 5, -6} ;

a = (int *)malloc(3*sizeof(int));

x = a;

for (int k = 1; k

a[k-1] = 3%k 2 ;

printf("%d", *x, "\t", "%d", *(x+1), "\t","%d", *(x+2), " ") ;

z = &b[2] ;

y = (++x)+1 ;

*x = *x+1 ;

printf("%d", *x, "\t", "%d", *y, "\t","%d", *z, " ") ;

*(--z) = *(y-1) + *x ;

*(z+1) = *(x+1) - 5 ;

c = x ;

printf("%d", *z, " ") ;

*y-- = (*++z) - (*&a[2]) ;

printf("%d", *z, " ") ;

printf("%d", *x+4, " ") ;

for(int j = 0 ; j

{

printf("%d", *(a+j), "\t", "%d", *(b+j), " ") ;

}

free(a);

a = NULL ;

"#"*p9+9+++4 2=4b[2] ; b[415 16 b- ) ! []2 "#"*p9+9+++4 2=4b[2] ; b[415 16 b- ) ! []2

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

Step: 3

blur-text-image

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago