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
Where in memory are my variables stored?
explain what is a newline escape sequence?
Does c have an equivalent to pascals with statement?
What is malloc calloc and realloc in c?
Where we use clrscr in c?
Explain what does the function toupper() do?
Is c programming hard?
Explain the process of converting a Tree into a Binary Tree.
Why can arithmetic operations not be performed on void pointers?
What is a example of a variable?
What is array in C
What do you mean by recursion in c?
What is the difference between union and anonymous union?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What happens if header file is included twice?