hetThe code is the executing fine,but i need to keep a pointer variable to return the last index of the array

//for eg if i enter n as 20,my lastindex is 19,the pointer will return the lastindex...

```
void sort(int a[],int *,int);
void swap(int a[],int *,int,int);
int main(void)
{
int i,n,a[100],b[100];
printf("\n Enter the number of items for A and B:\n",n);
scanf("%d",&n);
printf("\n Sorting is only possible if A and B are same\n");
printf("\n Enter the elements of the array for A \n ");
for(i = 0; i<n; i++)
{
scanf("%d",&a[i]);
}
printf("\n Enter the elements of the array for B \n" );
for(i=0; i<n; i++)
{
scanf("%d",&b[i]);
}
printf("\n Input Elements \n");
for(i=0;i<n;i++)
printf("\n%d %3d\n",a[i],b[i]);
sort(a,b,n);
printf("\nAfter sorting, A is the key:\n a: b:\n\n");
for(i=0;i<n;i++)
printf("\n%d%3d\n",a[i],b[i]);
printf("\n");
return 0;
}
void sort(int a[], int *b, int n)
{
int i,j;
for(i = 0;i < n-1; i++)
{
for(j = i+1;j<n;j++)
{
if((a[i]>a[j]))
{
swap(a,b,i,j);
}
}
}
}
void swap(int a[], int *b, int i, int j)
{
int temp;
temp = a[i];
a[i] = a[j];
a[j] = temp;
//swap the b array
temp = b[i];
b[i] = b[j];
b[j]= temp;
}
```