Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2. templateSwap is the template function that we wrote in today\'s class (availa

ID: 3701391 • Letter: 2

Question

2. templateSwap is the template function that we wrote in today's class (available in lecture slides and example code). Read the following code and answer questions: typedef ints ArrayPointer ArrayPointer a, b, c: a new int [3]: b new int [31: int i; atili; b[1] -i * 100; c-a: templateSwap(a, b); bl01 42: (1) what are the values in array a, b, and c, i.e., in a [0.2], b[0.21, and c[0.21 before e swap? Draw a diagram of memory template of a, b, and c to help if needed. a[0. .2] means the elements a[0], a[1], a[2] (2) What are the values in array a, b, and c,ie, in a 0.2,b(0.2], and c[O.2) after the swap? (3) What are swapped in function call templateSwap?

Explanation / Answer

1.

a[0..2] = {0,1,2}

b[0..2] = {0,100,200}

c[0..2] = {0,1,2}

2.

a[0..2] = {0,100,200}

b[0..2] = {0,1,2}

c[0..2] = {0,1,2}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote