Do you seek a constant whose value is set when you write the source code and that never changes after that ... or do you seek a variable that your program can alter at run-time, but whose value is retained while power is off?
The first case can usually be accomplished like this:
- static const int variable = 10;
The C Standard doesn't require it, but most compilers for embedded systems will store a variable such as this in the same place that the program instructions go; and that is usually some sort of read-only memory.
The second case is more idiosyncratic. Your hardware needs to have some sort of NVRAM. You need to study your compiler and linker documentation to learn the compiler-specific method of making use of special memory like that.