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,

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

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!