joeanderson4959 joeanderson4959
  • 15-08-2019
  • Computers and Technology
contestada

The variables xp and yp have both been declared as pointers to integers, and have been assigned values. Write the code to exchange the two integers

Respuesta :

cdw2014
cdw2014 cdw2014
  • 15-08-2019
The question is asking us to swap the values of xp and yp while not changing where they point to. Setting xp equal to yp would not work because then we couldn't change yp since the value for xp was overwritten. We can use a third variable to swap them.

int zp = xp;
xp = yp;
yp= zp;
Answer Link

Otras preguntas

what is the value of 6 in 89.6
Case company allocates $5 overhead to each unit produced. the company uses a plantwide overhead rate with machine hours as the allocation base. given the amount
How would Ban Zhao define an ideal woman?
Which of the following is typically found in a developing nation? A. advanced social programs B. lack of industrialization C. highly diversified economy D. str
During dna replication the original strand (attcgcgattta) was replicated as (attcggattta). what type of mutation has is present? deletion duplication transposon
Henry bought a movie tickets for himself and 6 of his friends.each movie ticket cost $7.85.How much money did Henry spend on tickets?
What were reasons for disputes between colonists and the British that led to events like the one shown in this engraving?
What is the approximate difference in energy between the two chair conformations of trans-2-methyl-1-isopropylcyclohexane?
If an f1 plant is backcrossed to one of the pure-breeding parental plants, what is the expected ratio of phenotypes among progeny?
what is 6.25 divided by 2.5