The variables xp and yp have both been declared as pointers to integers , and have been assigned values (i.e., they are each pointing to an integer value ). Write the code to exchange the values of these two variables (so that after the swap xp points to what yp originally pointed to and vice-versa-- in other words, in this exercise, you are swapping the pointers). Declare any necessary variables

Respuesta :

Limosa

Answer:

Following code are:

int *temp;   //declaration of variable

// perform swapping

temp = xp;    

xp = yp;

yp = temp;

Explanation:

we declare an integer data type pointer variable "*temp"  then perform swapping between them.

The variables "xp" and "yp" are already declared and these variables are performing swapping among three.