i have written the C code complied it with 0 error and 0 warnings.
now how can i divide this codes into small c codes in same project.
please help me as i am new to embedded world
I think a prime example of Coincidental Cohesion is to put all your globals from the whole project into one file called "globals.c" - with a corresponding "globals.h"...
one file with the following
#if ralph #define fido extern #else #define fido #endif
and all definitions/declarations preceeded by fido
then in one .c file #define ralph
Erik
#if ralph #define fido extern #else #define fido #endif /*there should be an*/ #undef ralph /*here, to avoid nasty side effects from multiple inclusion
Let's note that most people still using that "trick" actually call that fido "EXTERN" or some variation of that to make it at least marginally self-explaining.
But it's still a half-baked idea. For starters, it breaks down as soon as you want to have explitly initialized globals use the same scheme. It also upsets various kinds of static analyzers that hate it when the same header expands to different things in different translation units.