Question: 3. Consider the following program which consists of functions: main, foo, and bar. For each of the operations indicate the state of the array at

3. Consider the following program which consists of functions: main, foo, and bar. For each of the operations indicate the state of the array at the time of those operations in the boxes to the right of main. void foo(int* a, int *b) { int* temp = a; a = b; b = temp; } int main() { void bar(int* a, int *b) { int temp = *a; *a = *b; *b = temp; } 13 LO int arr[6] = { 13, 6, 3, 17, 80, -5 }; int *ptr &arr[2]; 6 -5 3 17 80 *(ptr + 2) = 36; ptr - - 2; ptr[O] = -1; *(arr + 1) = 42; foo(&arr[0], &arr[5]); bar(&ptr[2], arr+2); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
