Hi everyone,
I'm learning about how computer memory works in C programming. Can you share how you figure out where things go in memory when you write C code?
What tools or methods do you use to understand this?
Thanks for your help!
Hi everyone,
I'm learning about how computer memory works in C programming. Can you share how you figure out where things go in memory when you write C code?
What tools or methods do you use to understand this?
Thanks for your help!
Assuming you want to know the truth, and not just the first-level approximation...
On Linux you can use the 'objdump' command to see what the C compiler has generated - what goes where in memory.
But that's not the final word. It also pays to know how linker scripts work, as they combine the object files to make the executable, by combining segments and resolving address references. 'ld' has an option that prints the default linker script to stout, allowing you to investigate it. Have a look at the 'man' page for 'ld' to find it.