I'm studying functions by passing the parameter, the teacher asked to calculate the factorial of a number per pass parameter, the maximum I got was the code below, even though the code does not execute.
#include <stdio.h>
#include <stdlib.h>
void fatorial(int num, long int*fat);
int main()
{
int num;
printf("Digite um numero:\n");
scanf("%d", &num);
fatorial(num);
return 0;
}
void fatorial(int num, long int *fat)
{
for(fat = 1; num > 0; num = num - 1)
{
fat *= num;
}
printf("%ld\n", fat);
}