Question
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.
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 ;
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. =&b[2] ; b 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 **, *y, *z, *a, *c, b[3] = {-4,5,-6}; a = (int *)malloc(3*sizeof(int}); x= a; for (int k = 1; kStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started