#include<stdio.h>
int main()
{
int Ii = 0, Itemp;
int array_a[5] = {1,2,3,4,5};
int array_b[5] = {6,7,8,9,0};
int *a,*b;
a=array_a;
b=array_b;
while( Ii < 5 )
Itemp = *(a + Ii);
*(a + Ii) = *(b + Ii);
*(b + Ii) = Itemp;
Ii ++;
} Ii=0;
while(Ii < 5) // 交換後的a
printf("%d\t",array_a[Ii]);
Ii ++; }
printf("\n");
Ii = 0;
while(Ii < 5) // 交換過的b
printf("%d\t",array_b[Ii]);
}
#include<stdio.h>
int main()
{
int Ii = 0, Itemp;
int array_a[5] = {1,2,3,4,5};
int array_b[5] = {6,7,8,9,0};
int *a,*b;
a=array_a;
b=array_b;
while( Ii < 5 )
{
Itemp = *(a + Ii);
*(a + Ii) = *(b + Ii);
*(b + Ii) = Itemp;
Ii ++;
} Ii=0;
while(Ii < 5) // 交換後的a
{
printf("%d\t",array_a[Ii]);
Ii ++; }
printf("\n");
Ii = 0;
while(Ii < 5) // 交換過的b
{
printf("%d\t",array_b[Ii]);
Ii ++;
}
}