So if we check for if(i != NULL) , does it mean that the pointer is valid ?
No. It means the pointer is not NULL. In general, there is no way to check if a pointer is "valid" so you should avoid situations where you have invalid pointers hanging around.