All you need to do is put the function in one file and include it in the main file using "include" keyword. An example is below where we have two files mainfile.c and func.h. func.h will have the function and it will be called from mainfile.c. Compile both of these files and run.
mainfile.c
---------------------------------
Code:
#include<stdio.h>
#include "func.h"
int power(int m, int n);
main(){
int i;
for(i=0; i<=10; i++)
printf("%d %d\n", i, power(2,i));
return 0;
}
file 2: func.h
----------------------------
Code:
int power(int base, int n){
int i, p;
p = 1;
for(i = 1; i <= n; i++)
p = p * base;
return p;
}