Help understanding this function...
Code:
#include <stdio.h>
#define size 3
void setarr1(int b[ ]);
void setarr2(int b);
void main ( )
{
int a[size] = {2,7,6}; //size = 3
int i;
for(i = 0; i < size; i++)
{
if (i % 2 )
setarr2(a[i]);
else
setarr1(a);
}
for (i = size - 1; i >= 0; i--)
printf("%d\n", a[i]);
}
void setarr1(int b[ ])
{
int i, a = size-1;
for (i = 0; i < size; i++)
b[i] += b[i] + a--;
}
void setarr2 (int b)
{
b -= size;
}
Above is the function that I have try a long time to figure its output. I have try to trace out but I still don't know why its output will be 24, 31, 14. So, I really hope that someone help me understand this function pls ~ Very thanks you.