In Assembler, it was easy to determine the beginning and end of my code. Since I only had the one source file and I could place a "StartOfCode" label and "EndOfCode" label at the beginning and end of my code, and I could determine the amount of memory used by subtraction. I need to do this because I want to generate a CRC on only the memory occupied by my code -- not the empty/blank memory locations that follow my code in memory.
How do I determine the beginning and end of code programmatically in C? I'm not sure what other code is added to my code for "Startup", and the linker may place my routines differently than where I may expect them in memory, so trying to place empty functions or simple functions where I think the end of code will be may not always work as I expect.