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 explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code
What are the advantages and disadvantages of pointers?
What is static identifier?
Can a pointer point to null?
Explain what is meant by 'bit masking'?
Why do we use c for the speed of light?
What is c programming structure?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
What is malloc calloc and realloc in c?
Explain what is wrong with this program statement?
What is difference between scanf and gets?
What functions are in conio h?
What is the collection of communication lines and routers called?
What is the mean of function?
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.