| How can you control where data is stored in memory and access it?

Previous | Memory, C Variables, and Pointers | Next

Q: | How can you control where a program data is stored in the calculator's memory, and then how to access the data? By looking at your programs (cblaster etc.), you simply use memcpy to write to the array, which seems so easy! Is the array kept in memory because it's declared as static?
A: | Yes. Every static and global data (i.e. data which are declared out of functions) are kept in the `.89z`/`.9xz` file itself (more precise, in the area of the memory allocated to `.89z`/`.9xz` file), so they will survive after the end of the program. Local data are stored on the stack (so they will be deleted after the end of the function in which they are declared).