Hello folks,

I have some doubt regarding the creation of header files and libraries using C.

Suppose I am defining all the functionalities related to the Stack and I wan to create it as library, for eg. stack.C which will get me the object file, Stack.o in Linux OS and one file for definitions which I would include in the other client programs stack.h. Now suppose I want to create as many Stacks as I want just by including this file in the client programs. Now what should I use to accommodate this. One way is to use pointers in the stack.c file. Is there any other better option? Even using structures in the source code won't allow me to define functions in them.

Please help me out.

Recommended Answers

All 2 Replies

It really depends on what and how you wrote your code...Could we see it so as to make an informed decision.

I'm not sure I understand what you're asking. It sounds a bit like you want to create an abstract data type but don't know how. If that's the case, you can check out the libraries offered here for one such method. The data structures are a bit more complex than a stack, but the basic ADT setup would the same if I wrote a stack library.

If that's not what you want, be more specific.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.