This question already has an answer here:
- Is NULL always false? 9 answers
- if (!ptr) VS if (ptr == NULL) in C [duplicate] 1 answer
- while(foo) vs while(foo != NULL) 5 answers
Let's say a is a pointer, and after allocating memory for it, I want to check if the memory was allocated successfully, I've seen two ways doing this :
if(a != NULL)
if(a)
What is the difference between the first and second statements ?
Aucun commentaire:
Enregistrer un commentaire