When are you able to return NULL as the returning value of a C function?

后端 未结 5 1669
不思量自难忘°
不思量自难忘° 2021-01-26 07:22

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 retur

5条回答
  •  时光说笑
    2021-01-26 07:51

    NULL is definitely a pointer. So if your function is expected to return a pointer and for some reason cannot, it should return the obvious "invalid pointer", which is NULL.

提交回复
热议问题