19

Are zero and null perfect synonyms?

Daniel
  • 57,547
Rabskatran
  • 1,610
  • 7
    If you look in a dictionary you can easily see that they are not perfect synonyms. –  Sep 17 '10 at 15:18
  • 2
    In the programming language C (and some others), null is equivalent to zero. In other programming languages they correspond to values that are not equivalent. In the English language, however, the two words have different meanings, as the answers below explain. – nohat Sep 17 '10 at 20:41
  • 3
    dude you should have asked it on stackoverflow – Midhat Sep 19 '10 at 17:11
  • 6
    @nohat: I'm not going to get into programming languages here, but null and zero are not equivalent in C or any other programming language I know of, although one can mean the other in certain contexts. – David Thornley Sep 20 '10 at 18:04
  • @David Thornley, you’re right—I should have said they are equal. – nohat Sep 20 '10 at 18:07
  • 1
    @David: The value of NULL is equal to 0 in C, though types do not match. NULL is defined as (void *)0 (i.e. a null pointer). – Noldorin Sep 24 '10 at 19:03
  • @Noldrin - the symbol zero is converted into NULL by the compiler in (void *)0. The internal representation of NULL doesn't have to be zero and it's not correct to say that the NULL pointer is zero – mgb Apr 01 '11 at 16:21
  • 1
    If I ask someone, "How many apples do you have?" and he answers "Null", then I would imagine he was from Germany and answering in his own language. – GEdgar Feb 02 '12 at 02:27
  • @Noldrin: Hmm, you say NULL is equal to zero, but then in the same sentence you say that it is "(void )0". Isn't it obvious just from looking at the text that "0" and "(void )0" are not the same thing? The first is an integer and the second is a pointer. An integer equal to 0, and a pointer to an integer where the pointer is null, are not at all the same thing. But as others have said, we're far over the line from human language to computer language. – Jay Feb 06 '12 at 15:41

9 Answers9

22

'null' is qualitative, representing the absence of quantity. Closer to the word 'void' than the number 'zero'. Example: he reduced it to nil.

'zero' is quantitative. Example: he got zero on his exam.

Wadih M.
  • 1,631
  • 5
    If you are a programmer, "null" could mean zero but could not mean void. – mmyers Sep 17 '10 at 15:21
  • 4
    Programming questions should go on stackoverflow.com –  Sep 17 '10 at 15:22
  • 12
    This isn't necessarily programming related. – Wadih M. Sep 17 '10 at 15:22
  • 10
    @mmyers I don't think a programmer would consider null and zero equivalent. Zero is a number; it is information. Null is the absence of information. – pkaeding Sep 17 '10 at 16:10
  • @pkaeding: #define NULL 0 – mmyers Sep 17 '10 at 17:32
  • 2
    @mmyers, true, in some languages, and according to some conventions, 0 and null are used interchangeably. I personally feel this is a dangerous practice, because if you consider them to be equivalent, then how to signify a lack of data? – pkaeding Sep 17 '10 at 17:54
  • @mmyers #typedef void NULL will certainly make NULL mean void in a programming context, so the programming analogy really isn't that useful. – ssakl Sep 17 '10 at 17:58
  • @ssakl: Yes, but #define NULL 0 is in the C++ standard library. And that's only tangentially related to the subject now, so I'll stop there. – mmyers Sep 17 '10 at 18:25
  • "in some languages...0 and null are used interchangeably" In German, the word for "zero" is "null"! It must be confusing sometimes when they are programming stuff. – Kosmonaut Sep 17 '10 at 19:06
  • to reference a popular meme… zero is when the toilet paper roll is out of toilet paper, null is when there’s no toilet paper roll at all, and void is when there’s not even a toilet paper holder in the bathroom. – chharvey Jun 01 '20 at 23:02
8

No, they are not the same.

In an everyday language context, 'null' can mean that something is meaningless, as in:

The agreement became null when Sam failed to fulfill his side.

In a programming/data context (though I still think this is a language question, rather than a programming question), 'null' can mean the absence of information. If you are wondering how many apples there are, 'null' means 'I don't know'. 'Zero' means that you know that there aren't any apples.

Zero always refers to a quantity.

pkaeding
  • 1,737
  • Isn't "null" used in phone numbers and floors, levels, etc... – Rabskatran Nov 24 '10 at 15:45
  • 1
    @Pierre: I've never heard it used in phone numbers ("zero" or, in the UK at least, "Oh" is used for a digit 0). In the UK the lowest floor is the "ground" floor, and in the US they avoid the issue entirely by starting counting at 1 :-) – psmears Feb 13 '11 at 12:37
8

Is there a difference between a cheque(check) with $0.00 and a NULL(VOID) check?

Yes.

A $0.00 cheque will put exactly $0.00 into your bank account.

A check with VOID written on it will not be processed.

The difference may be subtle, but there is a difference.

0 represents an integer in the set of all integers (called the set Z in mathematics) NULL is not an integer, and it could represent the absence of things that aren't even numbers.

A NULL and VOID Check for example.

A NULL Marriage.

A NULL Agreement

OneProton
  • 4,199
  • Would a bank actually process a $0.00 cheque? I doubt it. What would that accomplish? – Mr. Shiny and New 安宇 Sep 20 '10 at 16:20
  • 1
    @Mr. Shiny and New: Some people have written checks for $0.00 when being dunned for arrears of $0.00, with success. – David Thornley Sep 20 '10 at 18:06
  • @David Thornley: Sure, the act of mailing the cheque might prompt a person to fix something, but I seriously doubt the cheque goes all the way to the bank whereupon it is DEPOSITED. – Mr. Shiny and New 安宇 Sep 20 '10 at 18:49
  • @Mr. Shiny and New: You never know. A lot of check processing is automated these days. – David Thornley Sep 22 '10 at 14:53
  • @David Thornley: actually the automated processing would, I think, reject $0 amounts. I know that you can't capture a $0 amount from a credit-card electronically, it just fails. But given how screwed up the chequing system is in North America..... anything is possible I suppose. :) – Mr. Shiny and New 安宇 Sep 22 '10 at 19:48
  • Any good automated system would indeed filter out amounts <= 0.0. It would also filter out negative numbers as well as likely flagging suspiciously high numbers. Because 0 is a valid integers, this has to be programmed in as a constaint. A VOID check, on the other hand, doesn't have a "value" to process and so it CAN'T be processed, even if it were allowed. – OneProton Sep 23 '10 at 16:42
7

null and zero are used in many contexts where they have different meanings. In math you can have a set with no items in it (a null set) or you can have a set with a zero in it ({ 0 }) which are not the same.

In programming some languages make null the same as zero (C++) but some don't (Java).

In databases a record might have a null value in one field or it might have a zero and these are not the same.

Zero is can be used to indicate a counted quantity whereas null cannot.

  • 3
    Null and zero are not the same thing in C++. A null pointer is a constant integral expression yielding zero converted to a pointer type. Further discussion on Stack Overflow. – David Thornley Sep 20 '10 at 18:08
  • @David Thornley: http://www2.research.att.com/~bs/bs_faq2.html#null seems to say null is zero, or close enough for this conversation. – Mr. Shiny and New 安宇 Sep 20 '10 at 18:51
2

It's not just null and zero too. What about "nothing","naugt","none" etc.

Zero is usually a noun. Zero is a number. Zero can refer to the symbol "0".

Null is usually an adjective (Null set, Null argument, Null pointer, *a nullity). Null is a not a number, usually has a different symbol each time.

Programmers are forced to make these distinctions all the time (although, 'null' is often modelled as the number 0). Although it is important in programming, the distinction is more to do with logic and mathematics.

They do have quite different roles in language although I guess in a few cases they are the same.

History of Zero

Lucas
  • 840
2

The words have very different meanings.

In math, I can do an equation, such as subtract two numbers, and get zero. If I don't answer the question, it could be considered null. If the question were an elementary test, zero could be the correct answer, worth points, whereas not answering the question does not result in a correct answer.

So, one can indicate that a computation has been done, the other that it has not been done.

1

"Nula" is the word for "0" in Hungarian and other European languages.

"Null" means "void of legal force" ... that's essentially "invalid". It's an adjective, as has been mentioned.

I'm not a programmer, so maybe that's why I don't equate the two at all.

Compare "Are you Rachel?" with "Are you tired?"

anastasia
  • 152
0

"Zero" is a number, an integer between -1 and 1. It is a physical quantity representing no countable number of an object.

"Null" is a concept of irrelevance or undefined state. For example, an agreement might become "null and void" when it is no longer applicable or enforceable, or a computer data structure pointer with no instantiation associated with it might be considered "null".

The confusion comes in the representation of a computer NULL in execution. Typically, the NULL is represented as a 0 in the memory or code. But that is just a convention. It's like saying "I am Spoxjox". Well, no, I am not Spoxjox. I am represented by the "name" or "tag" or "handle" of "Spoxjox", but I am a human being, not a sequence of letters on a discussion board. Similarly, the concept of NULL might be represented by a zero (0), but it is not the same as the number zero.

Spoxjox
  • 1,946
0

No. Zero is a number. Zero is also a place where a mathematical function achieves an output value of zero. Null has a wide variety of uses. Here are a few:

null set - a set devoid of elements

null contract - unenforceable contract

The Java computer language uses null as a "graveyard" object that holds no value

ncmathsadist
  • 1,050
  • 8
  • 15