answersLogoWhite

0

In order to compare any two values, both values must be stored somewhere otherwise it would be impossible for the machine to refer to those values let alone operate upon them. Typically we store variables in main memory, however values can also be stored directly in the machine's registers. These are known as register variables and the only practical difference between a register variable and an ordinary variable is that we cannot take the memory address of a register variable (because it has no address to take).

If we can take the address of a variable then that variable is said to have identity because it exists in memory and we can identify it solely by its address. When comparing values that have identity, we can either compare the values themselves or we can compare their identities. The latter helps us determine whether two values are the same variable or not.

The address of a variable may or may not be known at compile time. If the address is known at compile time then we can name the variable and refer to it by either its name or its address. Variables generated at runtime are anonymous and can only be referred to by their address (which we must store in another variable known as a pointer variable). Conversely, register variables must always be named, but they have no identity.

Regardless of whether a variable has a name, an identity, or both, the machine simply cannot operate upon values without using variables.

User Avatar

Wiki User

7y ago

Still curious? Ask our experts.

Chat with our AI personalities

EzraEzra
Faith is not about having all the answers, but learning to ask the right questions.
Chat with Ezra
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
RafaRafa
There's no fun in playing it safe. Why not try something a little unhinged?
Chat with Rafa
More answers

They sometimes do, but not always. Provided x is a real number, I can confidently assert that x2 + 1 > x2. I do not need to know the value of x. So the word "must" in the question is not appropriate.

User Avatar

Wiki User

7y ago
User Avatar

Add your answer:

Earn +20 pts
Q: Why must numeric values be assigned to variables when comparing results?
Write your answer...
Submit
Still have questions?
magnify glass
imp