c program to swap two arrays

Solutions on MaxInterview for c program to swap two arrays by the best coders in the world

showing results for - "c program to swap two arrays"
Gianluca
05 May 2017
1/* C Program to Swap Two Arrays Without Using Temp Variable */
2#include<stdio.h>
3
4int main()
5{
6 int Size, i, a[10], b[10], Temp[10];
7  
8 printf("\nPlease Enter the Size of the Array\n");
9 scanf("%d", &Size);
10 
11 printf("\nPlease Enter the First Array Elements\n");
12 for(i = 0; i < Size; i++)
13  {
14      scanf("%d", &a[i]);
15  }
16   
17 printf("\nPlease Enter the Second Array Elements\n");
18 for(i = 0; i < Size; i ++)
19  {
20      scanf("%d", &b[i]);
21  }
22
23 //Swapping two Arrays 
24 for(i = 0; i < Size; i++)
25  {
26    a[i] = a[i] + b[i];
27    b[i] = a[i] - b[i]; 
28    a[i] = a[i] - b[i];
29  }
30
31 printf("\n a[%d] Array Elements After Swapping \n", Size); 
32 for(i = 0; i < Size; i ++)
33  {
34      printf(" %d \t ",a[i]);
35  }
36
37printf("\n\n b[%d] Array Elements After Swapping \n", Size); 
38 for(i = 0; i < Size; i ++)
39  {
40      printf(" %d \t ",b[i]);
41  }
42
43  return 0;
44} 
queries leading to this page
c swap array elements within an arrayswap the numbers in array in cc program to swap numbers between two arrayarray swap cswapping of array in cc swap two parts of arrays cwrite a c program for swapping of two arrays swapping of two numbers in array in chow to swap two places in ana array cswap array in cswap array elements in cc program to swap two arraysc swap arrayswap two array in c swapping of two numbers in an array in cswap arrays cswap an array of arrays cc program to swap two numbers algorithmswap funcing an array in chow to swap two numbers in array in cc swap two arraysswap arrays in cswap two numbers in array in chow to swap two numbers in an array in cswapping of numbers using array in cswap 2 arrays in cswapping two array elements in cc program to swap two numbers explainedswap function in c arrayswap function for an array in cswap function in c for arraywrite a c program to swap pair of elements in an arrayswap two arrays in cswap two elements in array cswap every two integers in array in cswap 2 elements in array in cswapping two elements in an array cswap two values in array cswap array function in cswap two arraysc swap two numers in arraywrite a c program to swap elements of two variables and two arrays c swap two elements in arrayswapping two arrays in cswap function in c arraysswap operation in c arraysfunction to swap array in cc program function to swap two elements in arrayswapping 2 arrays in for loops in cwrite a c program for swapping of two arraysswap every two integers in cswap an array in cc swap array elementsswap elements of array in carray swap using 2 variable in cswap in int array in cswap in 2 array in cc program to swap two arrays