Is zero the same as null? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is zero the same as null?

22nd May 2017, 12:24 PM
lord_of_code
3 Answers
+ 6
Null indicates the absence of a value. Zero is just a number.
22nd May 2017, 1:22 PM
Caleb Jore
Caleb Jore - avatar
0
Well, because you put the tag if-statement, yes, there are equal in that sense. In a way, they behave equally when treated them as a bool. Let me explain. If you have an if statement with NULL, nullptr or 0 as the statement, they will always be implicitly casted to bool as false. So, if(!0 && !NULL && !nullptr) { // This will always be executed. }
22nd May 2017, 3:50 PM
Testing002
- 2
zero = number.. can be as index number, etc... null ?? I'm not friends with that😁
22nd May 2017, 12:42 PM
Mugfirfauzy Siregar
Mugfirfauzy Siregar - avatar