Does anybody here know how can i manage global data in multifile
C programs ?

Plz do reply.

Recommended Answers

All 4 Replies

Care to elaborate what you are trying to convey here by posting your code or with an example....

Or is it that you have declared all the global data or variables in one file and want your progams to access those ?

globals are evil. They reek of design errors.

But if you insist on using them, put them in a header file you #include in everything.

globals are evil. They reek of design errors.

But if you insist on using them, put them in a header file you #include in everything.

And in so doing create multiple definition errors for each variable. Instead, put the extern declarations in the header file and leave the globals defined in one source file.

yup, that's what I meant ;)

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.