This is some kind of stupid question .. I want to ask .. Please help me figure this out.
const int i=100; //1 ///some code long add=(long)&i; //2
Doubt: for the above code ... the compiler first looks at all the codeto decide whether to allocate memory or not ... or first it will store the file variable in read-only memory, and then .. force the sequence out also by 2
doubt: why accept the address of a forced compiler variable to store the variable in memory. although rom or register also have an address
add , , i. , , , , i , / . .
add
i
const , . ( ), . const , , .
const
const , - . , . , , , .
, , , , , , , .
, , , , .
( const, ) ( ROM, ). (100 ) , .
, , .
const " ", , " const", ( ) . , , .
, C/++ ( !), , , .
: , , .
I am a little confused by what you ask, but looking at your code:
i = 100 with address 0x ????????????
add = no matter what address is stored as long int
There is no (dynamic) memory allocation in this code. Two local variables are created on the stack. The address I am taken and brutally inserted into the long, which is then assigned to the second variable.
Source: https://habr.com/ru/post/1792078/More articles:Что такое перезаписываемый API? - computer-scienceпредставляющий собой участок мозаики в виде дерева - rTransactionsScope Nuances - c #how to set up Box2D in xcode - iphoneCheck version of Python library that does not detect __version__ - pythonASP.NET MVC2 и MEF - Почему мой MefControllerFactory не может получить экспорт или метаданные? - c#gVim windows; how to get h and l to move along the lines of a new line - vimdocx - markup / markup - conversion docx - markupcomparing two string value values in JSP - struts2 - struts2cgi / py call inside PHP with parameters - variablesAll Articles