What is the difference between NULL and "0"?

What is the difference from NULL and "0"?

Example:

return NULL;
return 0;
+3
source share
1 answer

Conceptually, zero (0) is a number, and NULL is a value that represents "no value." Thus, 0 can be added, subtracted, etc., but NULL cannot. A NULL value for a variable can indicate, for example, that a variable has not yet been assigned a value.

NULL semantics may vary by language or application.

+11
source

Source: https://habr.com/ru/post/1796187/


All Articles