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