i have two array's say int array1[6] = { 2, 4, 5, 7, 9 }; & int array2[6] = {0 ,5 ,6 , 7, 3}
I will pass these to a function swap(array1,array2)
I am currently trying to do it as below
index =0;
while(array1[index] && array2[index] != NULL)
{
array1[index] = array1[index] ^ array2[index];
array2[index] = array1[index] ^ array2[index];
array1[index] = array1[index] ^ array2[index];
index++;
}
Is my approach correct? Please let me know your views
PS: I cannot send in array length as a parameter to the function. I would like to do this in C language.
Thanks