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
Multiply an Integer Number by 2 Without Using Multiplication Operator
In which header file is the null macro defined?
Do you have any idea how to compare array with pointer in c?
Differentiate between a structure and a union.
Who developed c language and when?
Why is it that not all header files are declared in every C program?
Which is best linux os?
What does c mean?
How will you write a code for accessing the length of an array without assigning it to another variable?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What is a file descriptor in c?
Give basis knowledge of web designing ...
what is uses of .net
What’s a signal? Explain what do I use signals for?
What is the role of && operator in a program code?