sambhaji s. rode


{ City } kolhapur
< Country > india
* Profession * software developer
User No # 60960
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 10
Users Marked my Answers as Wrong # 12
Questions / { sambhaji s. rode }
Questions Answers Category Views Company eMail




Answers / { sambhaji s. rode }

Question { 9973 }

HOW CAN ADD OUR FUNCTION IN LIBRARY.


Answer

just have ur function definition in one Cpp or C
file.....ie save it as .cpp or .C file....
then include the file as #include "program.c"
and then wherever you need call that functionin an another
program...
for example:
let me add my own ADDITION function in my library.....

this is my first file stored in .C....
int add(int a,int b)
{
int c;
c=a+b;
return c;
}
the file name for the above is add.c

then am opening my main program file in .c mode ....
#include
#include
#include"add.c"
void main()
{
int a,b,c;
scanf("%d%d",&a,&b);
c=add(a,b);
printf("\n the added sum is :%d",c);
getch();
}

Is This Answer Correct ?    10 Yes 12 No