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
Is there a way to compare two structure variables?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
What is structure in c definition?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
What is difference between arrays and pointers?
Where can I get an ansi-compatible lint?
What are 3 types of structures?
What does %c do in c?
What does %d do in c?
What is hashing in c language?
Which is an example of a structural homology?
Explain what is meant by high-order and low-order bytes?
Why do we need arrays in c?
What is the scope of global variable in c?
Explain threaded binary trees?