Extending array to source file from header file in C -


is there way extend 1 big array header file source file, , use elements in main program?

array

byte codes[95][8] = {             255, 255, 255, 255, 255, 255, 255, 255,  255, 255, 134, 255, 255, 255, 255, 255,  255, 143, 255, 143, 255, 255, 255, 255,  235, 128, 235, 143, 235, 255, 255, 255,  237, 213, 128, 213, 219, 255, 255, 255,  157, 155, 247, 226, 220, 255, 255, 255,  201, 112, 170, 221, 250, 255, 255, 255,  255, 175, 129, 255, 255, 255, 255, 255,  255, 227, 221, 190, 255, 255, 255, 255,  255, 190, 221, 227, 255, 255, 255, 255,  235, 247, 193, 247, 235, 255, 255, 255,  247, 247, 193, 247, 247, 255, 255, 255,  255, 250, 249, 255, 255, 255, 255, 255,  247, 247, 247, 247, 247, 255, 255, 255,  255, 252, 252, 255, 255, 255, 255, 255,  253, 251, 247, 239, 223, 255, 255, 255,  193, 186, 182, 174, 193, 255, 255, 255,  255, 222, 128, 254, 255, 255, 255, 255,  222, 188, 186, 182, 206, 255, 255, 255,  189, 190, 174, 150, 185, 255, 255, 255,  }; 

never define variables in header files. creates linker problems , bad program design. instead, array should declared

const byte codes[95][8] = { ... 

and placed in .c file. can have corresponding .h file

extern const byte codes[95][8]; 

include .h file caller , access array.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -