I got this in a company paper I was solving online...
Can someone explain me what this code should do?and whats the error?
int func (int (*)(int) , int);
int cube(int n)
{
return (n*n*n);
}
int main()
{
prinf("%d" , func(cube , 4));
}
int func(int (*tmp)(int in) , int n)
{
int res , i;
for(i = 1 ; i <= n ; i++)
res += *(tmp)(i);
return res;
}