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 to create c progarm without void main()?

1 Answers   NIIT,


Why c is called procedure oriented language?

0 Answers  


What are the advantages of Macro over function?

1 Answers  


What does volatile do?

0 Answers  


#define MAX 3 main() { printf("MAX = %d ",MAX ); #undef MAX #ifdef MAX printf("Vector Institute”); #endif }

1 Answers   Vector India,


write a program to compare 2 numbers without using logical operators?

5 Answers   IBM,


You are given a string which contains some special characters. You also have set of special characters. You are given other string (call it as pattern string). Your job is to write a program to replace each special characters in given string by pattern string. You are not allowed to create new resulting string. You need to allocate some new memory to given existing string but constraint is you can only allocate memory one time. Allocate memory exactly what you need not more not less.

2 Answers   Microsoft,


what is const volatile?

2 Answers  


Explain two-dimensional array.

0 Answers  


i need all types of question paper releted to "c" and other language.

0 Answers  


for (i <= 5 && i >= -1;++i; i > 0) { printf("%d ", i); }

1 Answers  


What is the difference between far and near ?

0 Answers  


Categories