mercredi 24 juillet 2019

Why size of pointed object of pointer is not zero even if we assigned pointer to NULL?

I am wondering why size of object pointed by pointer is not zero even if we assigned pointer to NULL.Can anyone explain this?

compiled on g++ 4.8,ubuntu 14.04

Foo * foo=NULL;
cout<<"Size of pointed object of foo:"<<sizeof(*foo)<<endl;  //why it is not zero

Aucun commentaire:

Enregistrer un commentaire