check if null cpp code example
Example 1: if(pointer) in c
int * some_ptr;
// ...
if (some_ptr)
{
// Proceed
}
else
{
// Handle null-pointer error
}
Example 2: c check if null
int * some_ptr;
if (some_ptr == NULL){
} else {
}
int * some_ptr;
// ...
if (some_ptr)
{
// Proceed
}
else
{
// Handle null-pointer error
}
int * some_ptr;
if (some_ptr == NULL){
} else {
}