I am trying to reverse the array.
#include<stdio.h>
//code to reverse the current array1
void reverse(int array1[]){
int i;
int n=3;
for (i = 0; i <n; i++)
{
array1[i]=array1[n-i-1];
printf("%d\t",array1[i]);
}
}
int main(){
int array1[]={1,2,3};
reverse(array1);
}
result 3 2 3
when i compile this code i am getting 3 in array[0] poistion what is my error?