So here's my code.
#include<stdio.h>
 int main()
 {
  int a[4]={6,2,7,3};
  sort(a,4);
  int i;
  for(i=0;i<4;i++)
  printf("%d",a[i]);
 }
  int sort(int a[],int n)
  {
   int i,j,temp;
   for (i=0; i< (n -1); i++)
   {
    for(j = (i+1); j < n; j++)
    {
     if (a[i]< a[j])
     {
       temp= a[i];
       a[i] = a[j];
       a[j] = temp;
     }
    }
   }
  }
and the output is 7632. I thought a variable's value is never changed in main when passed to a function (unless using pointers). It's just photocopied and operations are done. But here the values of a[i]'s are changing in the main function. How does that work? I am not even returning the sorted array.
 
     
     
    