How can I write the header file, when I include header file, I can use the function of inside lib.c?
Can this lib.c compile to *.lib wihout any code added?
How to avoid double call of header file?

For example, the library program lib.c
Code:
unsigned int factorial(unsigned int n)
{
      if(n==0||n==1)
         return 1;
      else
         return factorial(n-1);
}
And the header file lib.h
Code:
unsigned int factorial(unsigned int);
The Main program
Code:
#include <stdio.h>
#include "lib.h"

int main(void)
{
   printf("%d",factorial(3));
   return 0;
}