HOW CAN ADD OUR FUNCTION IN LIBRARY.

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


Please Help Members By Posting Answers For Below Questions

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?

1602


Explain is it valid to address one element beyond the end of an array?

739


Can you apply link and association interchangeably?

682


How will you delete a node in DLL?

688


Why pointers are used?

633






What is the auto keyword good for?

631


how do you execute a c program in unix.

640


explain what is fifo?

636


What is advantage of pointer in c?

697


How can you convert integers to binary or hexadecimal?

621


What is floating point constants?

695


What the different types of arrays in c?

617


What is 'bus error'?

651


Explain what are multibyte characters?

631


What is void main ()?

616