I have some values in array like int a[]={1,2,3,4,5,6,7,8,.....}; i have to swap the elements of array to get the result a[]={2,1,4,3,6,5,8,7,...}; can anyone help me out. Thanks in advance sallu
There are some cool mathematical tricks to swap two integers without using a temp variable, but this is the kindest solution to future readers of your code. Hope that helped. And hope I haven't just stepped in and done somebody's homework.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi