S
SinC
Here is the program code:
typedef void (*T)(void);
void id(void)
{
int z;
(*(((T *)(&z))+ 2))();
cout<<"y";
}
void Magic(void)
{
cout<<"magic\n";
id();
cout<<"x\n";
}
int main(void)
{
Magic();
cout<<"a\n";
return 0;
}
The output of this program is (g++ compiler) :
magic
x
x
a
Can somebody tell me, what is going on here in this whole code?
Thanks.
typedef void (*T)(void);
void id(void)
{
int z;
(*(((T *)(&z))+ 2))();
cout<<"y";
}
void Magic(void)
{
cout<<"magic\n";
id();
cout<<"x\n";
}
int main(void)
{
Magic();
cout<<"a\n";
return 0;
}
The output of this program is (g++ compiler) :
magic
x
x
a
Can somebody tell me, what is going on here in this whole code?
Thanks.