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
If errno contains a nonzero number, is there an error?
What is register variable in c language?
how we can make 3d venturing graphics on outer interface
write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.
In which layer of the network datastructure format change is done
Are the expressions * ptr ++ and ++ * ptr same?
What are different types of operators?
Why is c called "mother" language?
How do we open a binary file in Read/Write mode in C?
Which control loop is recommended if you have to execute set of statements for fixed number of times?
What is sorting in c plus plus?
Explain what is the difference between far and near ?
What are the different types of endless loops?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
How can I open a file so that other programs can update it at the same time?