2

In programming the null pointer is a pointer that is equal to 0. I.e. it is a pointer with a concrete value equal to zero. It is the only one of course. So I suppose we should always say:

the null pointer

But many people use

a null pointer

So what is right?

For example:

Set the pointer to a/the null pointer. (Assign your pointer, which is not null a/the null pointer, i.e. make it equal to a/the null pointer.)

What article should be used?

2

Normally we'd say "a null pointer" because there can be many pointers with this value. Of course the value itself is unique, so we can say "... with the null value", but as the value fields are plural, we can say "... with a null value field" or "... with a null value". These would be common describing the programming language C or the basic machine operations. If you're speaking abstractly, you might well say "the biggest problem for debugging is the null pointer", exactly as we speak of "the whale" to mean the species.

It's easiest to understand by comparing with a conventional numeric variable. "Zero-valued variables" is plural, hence "a zero-valued variable", and "a variable with the value zero". But it's also perfectly correct idiomatically to write "all the variables with zeroes in them".

Essentially it's about whether you are thinking of the many places of these pointer variables, or some single distinguished value.

In programming languages where the uniqueness of a given object is important, such as Python, often you don't speak of pointers, and would very frequently write "the null object, the true object", etc.

To comment on your example, it reads as if it is confused between a pointer and a pointer to a pointer. (In C programming terms a char * vs char **)

Set the pointer to a/the null pointer.

This would normally be something like one of these:

  • Set the pointer to null
  • Make p a null pointer
  • Note: in mathematics, there is the concept of the empty set; there is only one. – Michael Harvey Jun 17 at 13:14
  • @MichaelHarvey I suppose we can say either "an empty set" or "the empty set" depending on context. – embedc Jun 17 at 16:40
  • @jonathanjo Thank you. Why "Set the pointer to null" and not "Set the pointer to the null"? – embedc Jun 17 at 16:41
  • @embedc In C and similar, it's usually the sense that we are zeroing a variable, or the whole of a memory block such as the BSS, and we're not usually interested in the fact that an unitialised variable has the same value as other uninitialised variables. In other languages with objects, we're more likely to say "the null object" or just "null", as we don't normally know the value of the pointer. – jonathanjo Jun 17 at 16:47
  • @MichaelHarvey In my experience, school maths teachers are quite likely to say "an empty set" as the emphasis is on the emptiness of the set. Higher level and university mathematicians almost always "the empty set", as the uniqueness of this is important to them. – jonathanjo Jun 17 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.