ok I CANT understand the logic of this recursion

the function is this:

Code:

void f(int A[], int n, int B[]){
if (!n)
f(A,n-1,B);
if (A[n-1]!=B[n-1])
A[n-1]=A[n-1]+B[n-1];
}

i think the output is obvious for n!=0, i tried to see the output for n=0

Code:

#include <stdio.h>
void f(int A[], int n, int B[]){
if (!n)
f(A,n-1,B);
if (A[n-1]!=B[n-1])
A[n-1]=A[n-1]+B[n-1];
}
int main(void){
int x[3] = {1,2,3};
int y[3] = {2,3,4};
int i;
f(x,0,y);
for (i=0;i<3;i++){
printf("%d ",x[i]);
}
printf("\n");
for (i=0;i<3;i++){
printf("%d ",y[i]);
}
getchar();
return 0;
}

the output here is

I CANT understand WHY, what's the logic behind this??????????

but then if I change the order of x,y declaration:

Code:

#include <stdio.h>
void f(int A[], int n, int B[]){
if (!n)
f(A,n-1,B);
if (A[n-1]!=B[n-1])
A[n-1]=A[n-1]+B[n-1];
}
int main(void){
int y[3] = {2,3,4};
int x[3] = {1,2,3}; // notice how i put x after y
int i;
f(x,0,y);
for (i=0;i<3;i++){
printf("%d ",x[i]);
}
printf("\n");
for (i=0;i<3;i++){
printf("%d ",y[i]);
}
getchar();
return 0;
}

the output is:

what's going on!!!!!!!!!???????????