Code:
int main(int argc, char *argv[]){
int M, *x, *p, y[101], m, i;
double k;
sscanf(argv[1], "%d", &M);
/*
//test sumPowers
k = 1.0;
printf("Power of first %d integers to %lf is %lf\n",M,k, sumPowersRec(M,k));
k = 3.4;
printf("Power of first %d integers to %lf is %lf\n",M,k, sumPowersRec(M,k));
k = 5.123;
printf("Power of first %d integers to %lf is %lf\n",M,k, sumPowersRec(M,k));
//test saveMoney
printf("Money saved after %d years with initial deposit $1000,\n annual deposits $100 and interest rate 0.01 is $%lf\n",M, saveMoney(1000,100, 0.01,M));
printf("Money saved after %d years with initial deposit $5234,\n annual deposits $600 and interest rate 0.02 is $%lf\n",M, saveMoney(5234,600, 0.02,M));
printf("Money saved after %d years with initial deposit $123,\n annual deposits $45 and interest rate 0.0067 is $%lf\n",M, saveMoney(123,45, 0.0067,M));
printf("Money saved after %d years with initial deposit $34567,\n annual deposits $9876 and interest rate 0.00567 is $%lf\n",M, saveMoney(34567,9876, 0.00576,M));
//test Pascal's triangle
for(m=0; m <= M; m++)
{
pascalsTriangle(y, m);
for(i=0; i<(M-m)*2; i++) printf(" ");
for(p = y; p <= y+m; p++)
printf("%4d", *p);
printf("\n");
}
*/
//test prime factors
x = primeFactors(M);
for(p = x; *p != 0; p++)
printf("%d ", *p);
printf("\n");
free(x);
return 0;
The main function looks like that.