When are you able to return NULL as the returning value of a C function?
I was wondering if you could tell me when you are able to return NULL , as the result of a function in C. For instance int lenght() can't return NULL because is is expecting an int in the return statement. But the function struct node* find(int key) , when working with linked lists allows me to return NULL. NULL is a pointer value - or rather a null-pointer value. NULL means that the function can't find where your pointer should point to - for example if you want to open a file, but it doesn't work your file pointer is returned as NULL . So you can test the value of a pointer and check to see