I have an array of int containing some values starting from index 0. I want to swap two values for example value of index 0 should be swapped with the value of index 1. How
swap only two values only once or want to do the same for the entire array.
Assuming that you only want to swap only two only once and is of type integer, then you can try this:
int temp=0; temp=arr[0]; arr[0]=arr[1]; arr[1]=temp;