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 calloc malloc realloc in c?
What is LINKED LIST? How can you access the last element in a linked list?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
What does emoji p mean?
What is return in c programming?
What is the meaning of 2d in c?
How do you do dynamic memory allocation in C applications?
Explain b+ tree?
explain how do you use macro?
#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
Explain what is the benefit of using enum to declare a constant?
What is string function c?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
Difference between exit() and _exit() function?