Answer Posted / raje
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();
}
Is This Answer Correct ? | 10 Yes | 12 No |
Post New Answer View All Answers
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?
Explain is it valid to address one element beyond the end of an array?
Can you apply link and association interchangeably?
How will you delete a node in DLL?
Why pointers are used?
What is the auto keyword good for?
how do you execute a c program in unix.
explain what is fifo?
What is advantage of pointer in c?
How can you convert integers to binary or hexadecimal?
What is floating point constants?
What the different types of arrays in c?
What is 'bus error'?
Explain what are multibyte characters?
What is void main ()?