看一些msdn就知道了,没什么好奇怪的吧malloc returns a void pointer to the allocated space, or NULL if there is insufficient memory available. To return a pointer to a type other than void, use a type cast on the return value. The storage space pointed to by the return value is guaranteed to be suitably aligned for storage of any type of object. If size is 0, malloc allocates a zero-length item in the heap and returns a valid pointer to that item. Always check the return from malloc, even if the amount of memory requested is small.
if ((ptr = (char *)malloc(0)) == NULL)
puts("Is Null");
else
puts("Not Null");你再试试
delete ptr;
这个时候ptr肯定不为NULL,不信你运行试试。
指针是否指向有效空间和本身为什么值并不冲突