title: How can I make my factorial function reentrant?
body: <p>I am supposed to write a reentrant factorial function, when I searched what a reentrant function is, I found many definitions, such as a reentrant function shouldn't use static or global variable,and the function cannot be changed while in use , I avoided using static or global variables, but I don't know if it is enough for my function be be reentrant or not,</p>
  
  <pre><code>    #include &lt;stdio.h&gt;
  
      int fact(int n){
         int c,fact = 1;
         for (c = 1; c &lt;= n; c++)
             fact = fact * c;
          return fact;
      }
      int main()
      {   
          int n;  
          printf("Enter a number to calculate its factorial\n");
          scanf("%d", &amp;n);
          fact(n);
          printf("Factorial of %d = %d\n", n, fact(n));
  
        return 0;
      }
  </code></pre>