Step1 : Make header file
Example
(write only function definition as you write in General C Program)
int add(int a,int b) { return(a+b); }
Step 2 : Save Code
Save Above Code with [.h ] Extension .
Let name of our header file be myfirstheader [ myfirstheader.h ]
Step 3 : Write Main C Program To Use header file
#include<stdio.h> #include "myfirstheader.h" void main() { int num1 = 10, num2 = 10, num3; num3 = add(num1, num2); printf("Addition of Two numbers : %d", num3); }
Note
All the Functions defined in the myfirstheader.h header file are now ready for use .