I was solving the question that prints primes up to a limit. I solved after looking at solution.

I couldn’t understand the use of pointers here.

```
int prime[100000000];
int* sieve(int A, int *n) {
*n = A; // length of result array
int *result = (int *) malloc(*n * sizeof(int));
int i,j;
prime[0] = 1;
prime[1] = 1;
int k=0;
for(i = 2;i <=A; i++)
{
if(prime[i] == 0)
{
for(j=i*2;j<=A;j+=i)
prime[j] = 1;
}
}
for(i = 2;i <= A; i++)
{
if(prime[i]==0)
result[k++] = i;
*n = k; // PLEASE HELP ME UNDERSTAND THE USE OF THIS LINE
}
return result;
}
```

I have commented the line I don’t understand.

Also, If I remove that line, I get array filled with 0s

Please help me here