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

Differentiate between calloc and malloc.

761


What is adt in c programming?

612


What is the maximum length of an identifier?

667


Why c is known as a mother language?

647


Is c is a high level language?

622






What will the preprocessor do for a program?

593


What are the types of assignment statements?

631


Can you apply link and association interchangeably?

680


When the macros gets expanded?

791


How is = symbol different from == symbol in c programming?

614


How to set file pointer to beginning c?

671


Can you please explain the difference between syntax vs logical error?

698


How can you find the exact size of a data type in c?

602


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

612


Is struct oop?

583