Is zero the same as null? | Sololearn: Learn to code for FREE!
Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję
+ 1

Is zero the same as null?

22nd May 2017, 12:24 PM
lord_of_code
2 odpowiedzi
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