Swap
The following code excerpt is taken from a program originally written by a csc108 student as part of his assignment.
Download files: Swap.java
Areas: Primitive types.
|
|
Swap.java |
|
|
| Question 1 |
| What does the following statement do? int a; |
| Question 2 |
| What happens when the statement a=b; is executed? |
| Question 3 |
| What exactly is the student trying to do in this program? |
| Question 4 |
| What is the purpose of the variable 'temp'? |
| Question 5 |
| The swapping function that this code excerpt does can be performed in another way, without the use of temp. Can you think of how this can be done? |
