int *foo=(int*)&emp1;

address of emp1 is stored in pointer foo by typecasting it to int*

I want to know why we can not assign foo the address of emp1 in this way :
int *foo = &emp1;

because emp1 is an object and not an integer variable ?

also, why can not we access the data without this typecast like :

cout<<*&emp1;

Last edited by cerebrum; 13Jul2009 at 17:36..