R
R. Anbeeswaran
Hi All,
void main()
{
const int i = 20;
int *p = const_cast<int*>(&i);
*p = 40;
cout <<"i="<< i <<"\t"<<"*p="<<*p<<"\n";
}
In the output of the prog. is :
i=20 *p=40
How is it true? (p is pointing to i). How is the particular address
referenced to two different values?
In the Quick Watch, (Visutal Studio is used for compilation & debug),
the value of 'i' and '*p' are same. But, it is flashed out with the
different values? The result is same in the release mode also.
All assistance are appreciated.
Cheers,
R. Anbeeswaran.
void main()
{
const int i = 20;
int *p = const_cast<int*>(&i);
*p = 40;
cout <<"i="<< i <<"\t"<<"*p="<<*p<<"\n";
}
In the output of the prog. is :
i=20 *p=40
How is it true? (p is pointing to i). How is the particular address
referenced to two different values?
In the Quick Watch, (Visutal Studio is used for compilation & debug),
the value of 'i' and '*p' are same. But, it is flashed out with the
different values? The result is same in the release mode also.
All assistance are appreciated.
Cheers,
R. Anbeeswaran.