Logo Search packages:      
Sourcecode: callgrind version File versions  Download package

rec.c

int calc(int x)
{
  int i, res = 0;

  for(i=0;i<x;i++)
    res += x;

  return x;
}

int funcA(int a, int x)
{
    if (a) 
      return funcC(a-1, x+1);

    return calc(x);
}

int funcB(int a, int x)
{
    if (a) 
      return funcA(a-1, x+2);

    return calc(x);
}

int funcC(int a, int x)
{
    if (a) 
      return funcB(a-1, x+3);

    return calc(x);
}

int main()
{
    return funcA(5,1) + funcB(5,1);
}

Generated by  Doxygen 1.6.0   Back to index