How we add our function in liabrary as liabrary function.
Exp. we want use our int factorical(int); function as int
pow(int,int); function working in math header file.



How we add our function in liabrary as liabrary function. Exp. we want use our int factorical(int);..

Answer / ataraxic

First, implement factorial in standalone module
(factorial.c for example).
Then complie it, create an archive and link it with our
program (my.c for example):

Compilation
1. gcc -c factorial.c -o factorial.o

Archiving
2. ar -rcsv libmy.a factorial.o

Compile our prog with new lib
3. gcc my.c -L. -lmy -lm -o my

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

differentiate between const char *a; char *const a; and char const *a;

2 Answers   College School Exams Tests, HCL, TCS,


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database

2 Answers   TCS, Unisys, Webyog,


write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that

3 Answers  


Table of Sudoku n*n

0 Answers  


Hi, main() { } Is a user defined function or Built in Functionn

26 Answers   Honeywell, Yahoo,






what is the difference b/w compiler and debugger?

2 Answers   Assurgent,


What is the advantage of a random access file?

0 Answers  


i have a written test for microland please give me test pattern

0 Answers   Microland,


Write a C program that reads a series of strings and prints only those ending in "ed"

2 Answers   Accenture,


What is the difference between macros and inline functions?

5 Answers   Global Edge, L&T,


write a program that eliminates the value of mathematical constant e by using the formula e=1+1/1!+1/2!+1/3!+

1 Answers   Reliance,


while running a program, i got the msg that press return key to exit.what that mean in C as there are no such options as far i know.

1 Answers   TCS,


Categories