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,](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f527b756897_51866f527b6e86fe.jpg)

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
Get step-by-step solutions from verified subject matter experts
