C/program to include c function in other program
Expert: Prince M. Premnath - 5/20/2008
Questionsir,suppose i written a program for factorial...with "fact.c" ..now i want to include this program on other program say("myprogram.c").its like including headerfile in c..
please help me in this regard..
AnswerHai Dear Mr Venkat !
Of course its simple , just follow the instructions.( assuming that you are Turbo C/C++ user )
Create a file that contains all the re-usable functions , say fact() and so on and save with a .h extension say "sample.h"
1. just copy the file into the INCLUDE Directory .
(0r)
Open the Option Menu -> Directories -> Include Directories ,
Include Directory text box will contain some Path name ,
eg if it contain c:\tc\INCLUDE
Then just place a ; at the end and enter path name of your header file "sample.h" assuming "sample.h" is placed in c:\tc\bin
Then the Entry in Option Menu -> Directories -> Include Directories
Will be like this c:\tc\INCLUDE;c:\tc\bin
Then open a new file say myprogram.c and use your own header file "sample.h" just like other header files
Eg;
#include<stdio.h>
#include<sample.h>
I Request you to kindly get back to me in case of issue !
Thanks and Regards !
Prince M. Premnath