Your taylor function doesn't look right to me. Maybe you need to refresh your memory.

Here's my quickly cooked up solution:

Code:

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
long factorial( long n )
{
if( n == 1 )
return 1;
else
return n*factorial(n-1);
}
double exp_maclaurin(double x, int n)
{
double sum = 1.0;
int i;
for(i=1;i<=n;i++)
{
sum += pow(x,i)/factorial(i);
}
return sum;
}
int main()
{
printf("Our function: exp(5) = %lf\n", exp_maclaurin(5,10));
printf("Built-in exp function: exp(5) = %lf\n", exp(5));
return 0;
}

Hope this helps.