On 26 Feb, 11:41, "Praveen" <rpraveen1...@gmail.comwrote:
Hi,
I would like to know is it possible not to use extern in a program.
I assume you want to access data in separate compilation units,
without using extern to share the data.
The answer is "yes" of course. It depends whether you are happy with
the alternatives.
The two approaches which come to mind are either
a) provide a function in the "owning" module which returns the address
of the item you want to access
b) provide more controlled access using accessor functions - one to
get the value of the item, one or more others to set/increment/
decrement/... the value.