The fact function should be int fact(int a). You're passing a simple integer. Make the loop for (i=1;i<=a;i++)

In main, you must allocate space for the array. If you expect the user to input a 10, then the array will have to be a[11]. So you need to limit the maximum allowable number and perhaps malloc() memory for the number of elements +1, or define a fixed array and make sure the user does not exceed this.