To swap the 3rd and 4th elements in the int array values you
To swap the 3rd and 4th elements in the int array values, you would do:
values[3] = values[4];
values[4] = values[3];
Solution
No, this is wrong attempt. As the value of 3rd element is not being saved any where this would be done by a temp variable.
temp=values[3];
values[3]=values[4];
values[4]=temp;
this will produce correct result.
![To swap the 3rd and 4th elements in the int array values, you would do: values[3] = values[4]; values[4] = values[3];SolutionNo, this is wrong attempt. As the v To swap the 3rd and 4th elements in the int array values, you would do: values[3] = values[4]; values[4] = values[3];SolutionNo, this is wrong attempt. As the v](/WebImages/33/to-swap-the-3rd-and-4th-elements-in-the-int-array-values-you-1097411-1761579072-0.webp)