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.

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What does void main () mean?

951


What is the difference between fread and fwrite function?

831


What is a nested loop?

858


Is int a keyword in c?

728


What is bubble sort technique in c?

760


What is the use of pragma in embedded c?

780


What is use of pointer?

775


What is uint8 in c?

873


Why enum is used in c?

695


What are the characteristics of arrays in c?

805


What is the use of getchar() function?

843


#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }

895


What are the parts of c program?

838


What is a null pointer in c?

825


Differentiate between #include<...> and #include '...'

811