question on small factorials problem(easy).

i have solved the problem using linked list. the solution is working well on my system’s compiler but on codechef it is showing a runntime error. Please tell me what is the problem ASAP.
this is my solution:
#include<stdio.h>
struct a{
int val;
struct a *next;
}tmp;
struct a create_list(struct a,int);
int fact(int);
void main()
{
int n1,n2,i,k,f;
struct a
start,*temp;
start=(struct a )malloc(sizeof(struct a));
scanf("%d",&n1);
for(i=0;i<n1;i++)
{
scanf("%d",&n2);
f=fact(n2);
start=create_list(start,f);
}
for(temp=start;temp!=NULL;temp=temp->next)
{
printf("\n%d",temp->val);
}
return(NULL);
}
int fact(int n4)
{
if(n4==1)
return(1);
else if(n4==2)
return(2);
else
return(n4
fact(n4-1));
}
struct a *create_list(struct a *start2,int n3)
{
struct a *n,tmp1;
n=(struct a
)malloc(sizeof(struct a));
n->val=n3;
if(start2==NULL)
{
n->next=start2;
start2=n;
}
else
{
for(tmp1=start2;tmp1->next!=NULL;tmp1=tmp1->next);
n->next=tmp1->next;
tmp1->next=n;
}
return start2;
}