Hi all,

It has been a while since I last programmed C, seems I have forgotten everything in the meantime... I have a very simple pointer question. Assuming that I have a function that computes a sum through loop iteration. Not only should this function return the loop counter but also the sum it computed. Since I can just return one value I assume the best I could do for the sum is declaring a pointer. Can I do that like this:

```
int loop_function(int* sum)
{
int len = 10;
for(j = 0; j < len; j++)
{
sum += j;
}
return(j);
}
....
int sum = 0;
loop_function(&sum);
printf("Sum is: %d", sum);
```

Or do I need to define an extra variable that points to sum which I pass then to the function?

Many thanks, Marcus