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

how does the C compiler interpret the following two statements p=p+x; q=q+y; a.p=p+x; q=q+y b.p=p+xq=q+y c.p=p+xq; q=q+y d.p=p+x/q=q+y

4 Answers   TCS,


Write a program of prime number using recursion.

0 Answers   Aspiring Minds,


What does *p++ do?

0 Answers  


What is the value of h?

0 Answers  


What are bit fields? What is their use?

2 Answers   Adobe,


write a method for an array in which it can display the largest n next largest value.

1 Answers   Value Labs,


What is printf () in c?

0 Answers  


actually i have 2 years teaching experience as computer faculty but now i am a DBA but when i go for interview many peoples asked me why i left my teaching profession and why i want to come in this field kindly give me the proper answer of this queston

3 Answers   Ramco,


What are different types of variables in c?

0 Answers  


Explain the difference between getch() and getche() in c?

0 Answers  


2. What does static variable mean?

2 Answers  


In a switch statement, what will happen if a break statement is omitted?

0 Answers  


Categories