I've been working with a program and I've been trying to conserve bytes and storage space.
I have many variables in my C program, but I wondered if I could reduce the program's size by making some of the variables that don't change throughout the program const or final.
So my questions are these:
- Is there any byte save when identifying static variables as
constant? - If bytes are saved by doing this, why are they saved? How does the program store the variable differently if it is
constant, and why does this way need less storage space? - If bytes are not saved by defining variables as
constant, then why would a developer define a variable this way in the first place? Could we not just leave out theconstjust in case we need to change the variable later (especially if there is no downfall in doing so)? - Are there only some IDEs/Languages that save bytes with
constantvariables?
Thanks for any help, it is greatly appreciated.