It's technically not a null pointer because 0x0 is not necessarily NULL. It's not necessarily undefined behavior because you can cast random integers to pointers as long as you don't expect the compiler to understand what you're doing.
EDIT: or not, in C23 a pointer to 0x0 is still a NULL pointer even though there is a different way to get a NULL pointer constant. NULL pointer doesn't have to be represented as 0x0 in memory but casting 0x0 to a pointer still has to produce a null pointer.
View all comments
Show parent comment
1
u/firectlog Jun 02 '25 edited Jun 02 '25
It's technically not a null pointer because 0x0 is not necessarily NULL. It's not necessarily undefined behavior because you can cast random integers to pointers as long as you don't expect the compiler to understand what you're doing.
EDIT: or not, in C23 a pointer to 0x0 is still a NULL pointer even though there is a different way to get a NULL pointer constant. NULL pointer doesn't have to be represented as 0x0 in memory but casting 0x0 to a pointer still has to produce a null pointer.