HOW CAN ADD OUR FUNCTION IN LIBRARY.

Answer Posted / vignesh1988i

it's simple.....

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<stdio.h>
#include<conio.h>
#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();
}



thank u

Is This Answer Correct ?    40 Yes 29 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where in memory are my variables stored?

828


explain what is a newline escape sequence?

863


Does c have an equivalent to pascals with statement?

756


What is malloc calloc and realloc in c?

911


Where we use clrscr in c?

892


Explain what does the function toupper() do?

819


Is c programming hard?

769


Explain the process of converting a Tree into a Binary Tree.

2382


Why can arithmetic operations not be performed on void pointers?

800


What is a example of a variable?

753


What is array in C

914


What do you mean by recursion in c?

849


What is the difference between union and anonymous union?

1038


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

903


What happens if header file is included twice?

883