Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - In C language, are constants stored in memory?
In C language, are constants stored in memory?
Constants and variables are placed in different sections. Once the program is loaded, constants/variables are naturally in memory.

During the running of the program, the data to be processed is stored in the memory. The data that remains constant all the time is called "constant", the storage unit that stores variable data is called "variable", and the data in it is called the value of variable.

Integers are converted into binary codes in the form of complement and stored in the computer.

Real numbers are converted into binary answer codes according to IEEE754 standard and stored in the computer.

In fact, the nature of characters is the same as that of integers (first, characters are converted into corresponding integers with ASCII code, and then integers are converted into binary in the form of complement).

Extended data:

In some advanced programming languages except' C/C++','constant' can be called' the quantity that never changes in the process of information change' and can be some fixed information that does not change with time; Characters (or strings) that can also be expressed as numerical values are usually used to identify, measure and compare the differences between them.

But in' C/c++ language,' constant' is not very accurate if it is described by' constant in operation', even in actual use, which is a wrong concept. In' C/C++', when defining' pointer constant', several different forms can be defined according to the different positions of' const'. Although it seems to conform to the concept of constant, its value or address value will change in practice. So essence is not an "unchangeable concept"

Baidu encyclopedia-unchanged