Given two int variables, i and j, which have been declared and initialized, and two other int variables, itemp and jtemp, which have been declared, write some code that swaps the values in i and j by copying their values to itemp and jtemp, respectively, and then copying itemp and jtemp to j and i, respectively.
.
.
Click on the title for the solution
.
.
jtemp = j;
itemp=i;
j= itemp;
i=jtemp;
.
Click on the title for the solution
.
.
This is the answer:
:
jtemp = j;
itemp=i;
j= itemp;
i=jtemp;
Comments
Post a Comment