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

Multiply an Integer Number by 2 Without Using Multiplication Operator

535


In which header file is the null macro defined?

1104


Do you have any idea how to compare array with pointer in c?

812


Differentiate between a structure and a union.

997


Who developed c language and when?

820


Why is it that not all header files are declared in every C program?

890


Which is best linux os?

758


What does c mean?

762


How will you write a code for accessing the length of an array without assigning it to another variable?

808


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.

2876


What is a file descriptor in c?

798


Give basis knowledge of web designing ...

1766


what is uses of .net

1456


What’s a signal? Explain what do I use signals for?

837


What is the role of && operator in a program code?

789