91.7k views
3 votes
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

1 Answer

3 votes

Answer:

Following code are:

int *temp; //declaration of variable

// perform swapping

temp = xp;

xp = yp;

yp = temp;

Step-by-step 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.

User Paltaa
by
5.5k points