Question: 6. [Pointers Understanding] Consider the following functions. int foo (int x, int *y) { x += 1; *y = x * 2; return x; }

 6. [Pointers Understanding] Consider the following functions. int foo (int x,int *y) { x += 1; *y = x * 2; return

6. [Pointers Understanding] Consider the following functions. int foo (int x, int *y) { x += 1; *y = x * 2; return x; } int bar (int *x) { int y = 5 + *X; return y; } For each of the questions below, what are the values of x and y after running the provided line of code. If you think the code may trigger an error at any point indicate the reason. Do not use a computer for solving this question. (a) int x = 1, y = 13; x = foo(x, &y); (a) (b) int x = 0, y = 0; x = foo(x, &y); (b) (c) int x = 5, y = 20; x = foo (x, &y); (c) (d) int x = 1, y 0; int z = bar(&x); x = z; (d) (e) int x = 1 , = 3; int z = bar(&y); x = z; (e)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!