We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
How does memory get allocated for the structure on Keil C51 8.x? Is it when I populated the contents of the structure right after declaring the structure does the memory get allocated. I am using a global var. to declare the structure.
Thanks
Sam
Are you talking about the memory layout of the structure or are you talking about placing of structure.
Declaring variables (be they structures or built-in data types) are no different from any other C/C++ compiler. The handling of global, static and auto variables follows from the requirements of the C standard.
Declaring a struct just informs about what a struct is - no memory allocated.
It isn't until you create a variable (whatever data type) that the compiler have to either allocate room on the stack or inform the linker about the symbol name and required amount of memory. How the startup code assigns initialized values to global variables is a completely different matter, and should normally be seen as a "magic" action somehow performed by the startup code.