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
What is an operator?
What is local and global variable in c?
What is 02d in c?
What is substring in c?
What is a string?
What is an expression?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
Explain what are the different data types in c?
What are the advantages of Macro over function?
How #define works?
What are the primitive data types in c?
number of times a digit is present in a number
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
How can I call a function with an argument list built up at run time?
What are the 5 types of organizational structures?