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
what value is returned to operating system after program execution?
What does c mean in basketball?
Do you have any idea about the use of "auto" keyword?
What are the advantages of union?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
Why is python slower than c?
What is LINKED LIST? How can you access the last element in a linked list?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
What's the difference between constant char *p and char * constant p?
Explain what math functions are available for integers? For floating point?
How can you find the exact size of a data type in c?
Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?
What is a pragma?
Why do we use stdio h and conio h?
What is "Duff's Device"?