Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Null pointer
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Value indicating that a referenced dataset is invalid or doesn't exist}} In [[computing]], a '''null pointer''' or '''null reference''' is a value saved for indicating that the [[Pointer (computer programming)|pointer]] or [[reference (computer science)|reference]] does not refer to a valid [[Object (computer science)|object]]. Programs routinely use null pointers to represent conditions such as the end of a [[List (computing)|list]] of unknown length or the failure to perform some action; this use of null pointers can be compared to [[nullable type]]s and to the ''Nothing'' value in an [[option type]]. A null pointer should not be confused with an [[uninitialized variable|uninitialized pointer]]: a null pointer is guaranteed to compare unequal to any pointer that points to a valid object. However, in general, most languages do not offer such guarantee for uninitialized pointers. It might compare equal to other, valid pointers; or it might compare equal to null pointers. It might do both at different times; or the comparison might be [[undefined behavior]]. Also, in languages offering such support, the correct use depends on the individual experience of each developer and linter tools. Even when used properly, null pointers are [[semantic completeness|semantically incomplete]], since they do not offer the possibility to express the difference between "not applicable", "not known", and "future" values.{{cn|date=March 2025}} Because a null pointer does not point to a meaningful object, an attempt to access the data stored at that (invalid) memory location may cause a run-time error or immediate program crash. This is the '''null pointer error'''. It is one of the most common types of software weaknesses,<ref>{{cite web |url=https://cwe.mitre.org/data/definitions/476.html |title=CWE-476: NULL Pointer Dereference |website=MITRE}}</ref> and [[Tony Hoare]], who introduced the concept, has referred to it as a "billion dollar mistake".<ref name=":0" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)