I have an array defined in a file and in another I have to use it, for e.g-
/* a.c - defines an array */ int a[] = {1,2,3,4,5,6,7,8,9}; /* b.c - declare
Put the variable in the header file only like this:
#ifndef A_DEF #define A_DEF int a[] = {1,2,3,4,5,6,7,8,9}; #endif
The conditional compilation will not allow variable redefinition. Thus you have access to it from anywhere.