C Program To Swap Two Arrays Using Pointers
C Program To Swap Two Arrays Using Pointers
#include <stdio.h>
#include <stdlib.h>
/* swaps two arrays using pointers */
void swapTwoArrays(int *arr1, int *arr2, int n) {
int i, temp;
for (i = 0; i < n; i++) {
temp = *(arr1 + i);
*(arr1 + i) = *(arr2 + i);
*(arr2 + i) = temp;
}
return;
}
int main() {
int *arr1, *arr2, i, j, n;
/* get the order of the arrays from the user */
printf("Enter the order of the arrays:");
scanf("%d", &n);