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
What is d scanf?
What is the importance of c in your views?
Is c still relevant?
What is the deal on sprintf_s return value?
Write a program to generate random numbers in c?
How can I open files mentioned on the command line, and parse option flags?
I heard that you have to include stdio.h before calling printf. Why?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
Explain how can a program be made to print the name of a source file where an error occurs?
What does 3 periods mean in texting?
Why is python slower than c?
What is the use of a semicolon (;) at the end of every program statement?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What are local static variables? How can you use them?
What is the use of a ‘ ’ character?