K
karthikbalaguru
Hi,
In the below code, the Gptr is pointing at where the variable 'a' used
to be, which no longer belongs to this program. So, it should fail.
But, it is printing '21' in VC++ 6.0. How is it possible ?
int *Gptr;
void TestGlobalPtr(void)
{
int a = 21;
Gptr = &a;
}
void main(void)
{
TestGlobalPtr();
printf("*Gptr = %d\n", *Gptr);
}
Any ideas ?
Thx in advans,
Karthik Balaguru . T
In the below code, the Gptr is pointing at where the variable 'a' used
to be, which no longer belongs to this program. So, it should fail.
But, it is printing '21' in VC++ 6.0. How is it possible ?
int *Gptr;
void TestGlobalPtr(void)
{
int a = 21;
Gptr = &a;
}
void main(void)
{
TestGlobalPtr();
printf("*Gptr = %d\n", *Gptr);
}
Any ideas ?
Thx in advans,
Karthik Balaguru . T