Since de-referencing nullptr (NULL) is an undefined behavior both in C and C++, I am wondering if expression &(*ptr) is a valid one if ptr is nullptr (NULL).
If it is also an undefined behavior, how does OFFSETOF macro in the linked answer work?
I always thought that ptr->field is a shorthand for (*ptr).field
I think the answer to my question is similar in C and C++.
 
     
     
    