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
How old is c programming language?
What is local and global variable in c?
Why we not create function inside function.
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
Explain how can I open a file so that other programs can update it at the same time?
What are the types of functions in c?
How can I call a function with an argument list built up at run time?
What is static identifier?
i want to know the procedure of qualcomm for getting a job through offcampus
What language is windows 1.0 written?
Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What is identifier in c?
What is keyword with example?
What are the parts of c program?
How to compare array with pointer in c?