I wrote a function containing array as argument, and call it by passing value of array as follows.
void arraytest(int a[]) { // changed the array a a
You are passing the value of the memory location of the first member of the array.
Therefore when you start modifying the array inside the function, you are modifying the original array.
Remember that a[1] is *(a+1).
a[1]
*(a+1)