Sorry... but.... How store the variable? Maybe in a file NOT in the "exe"...
The way ampos does it, is that he "stores" the variable value by including a line of code that sets the variable, so for example the full version could works like this:
Demo = 0
//..rest of code
IF (Demo = 0)
// full version, allow user access to all 100 levels
// demo version, allow user access only to first 5 levels
And when you want to create the demo version, you only have to change one line and then you compile again, like this.
Demo = 1
//..rest of code unchanged
Btw this is called a "hardcoded" value, because it's a value in the program, not a value read from an external data or settings file.
This way, the binary for the DEMO and FULL versions are almost identical, except for "Demo = 1" or "Demo = 0" line. So in theory, an evil hacker *could* try to find the byte in the binary that sets the 0 or 1, so he can change the DEMO app to FULL version. (although I think this is a lot of work and very difficult, so I doubt any hacker will even try it)