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

What is the size of enum in c?

594


What are the disadvantages of external storage class?

568


what type of questions arrive in interview over c programming?

1531


Tell me what is null pointer in c?

589


Should I learn c before c++?

561






What do you mean by dynamic memory allocation in c? What functions are used?

625


I have a varargs function which accepts a float parameter?

554


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

635


What does the function toupper() do?

629


What are local static variables? How can you use them?

620


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

703


What is huge pointer in c?

559


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

590


Give basis knowledge of web designing ...

1552


An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above

626