Question

Homework: 1) Given the following declaration : Int var1 = 9; Int var2 = 6; Int...

Homework:

1) Given the following declaration :

Int var1 = 9;

Int var2 = 6;

Int *varPtr1 = &var1;

Int *varPtr2 = &var2;

a) What are the value of var1 and var2 after the following code sequence?

Temp = *varPtr1;

*varPtr1 = *varPtr2;

*varPtr2 = temp;

     b) what did this sequence accomplish?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

b) above program accomplish swaping operation by using pointers.By using pointers instead of value we can access the address of the variable.it makes faster the operation.

Add a comment
Know the answer?
Add Answer to:
Homework: 1) Given the following declaration : Int var1 = 9; Int var2 = 6; Int...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT