a value indicating that a pointer does not refer to a valid object
In computing, a null pointer (sometimes shortened to nullptr or null) or null reference is a value indicating that the pointer or reference does not refer to an object. Programs routinely use … Wikipedia
🌐
Wikipedia
en.wikipedia.org › wiki › Null_pointer
Null pointer - Wikipedia
2 weeks ago - In computing, a null pointer (sometimes shortened to nullptr or null) or null reference is a value indicating that the pointer or reference does not refer to an object. Programs routinely use null pointers to represent conditions such as the end of a list of unknown length or the failure to ...
🌐
GeeksforGeeks
geeksforgeeks.org › c language › null-pointer-in-c
NULL Pointer in C - GeeksforGeeks
The Null Pointer is the pointer that does not point to any location but NULL. According to C11 standard: “An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.
Published   January 10, 2025
Discussions

Trying to understand NULL pointers
NULL is equivalent to 0 and equivalent to nullptr (in C++). It's an address that is "universally invalid." You can store 0x2093704802934 in a pointer and it will be invalid too (I'm sure) but it's not a convention. NULL is this convention that says "the pointer is not valid" and/or "the pointer hasn't been initialized yet" or "the memory pointed to has been released and I have invalidated the pointer by setting it to NULL." You store this value in a "pointer", like "int* s = 0" to show that it is not pointing to anything. And in your code you will check whether the pointer (s in my example) is equal to NULL (invalid) or not (valid). First you create a pointer, then you initialize it, then you use it, then you release it. More on reddit.com
🌐 r/learnprogramming
18
1
December 30, 2021
C++ What are the NULL pointer values? - Stack Overflow
I recently saw an article that mentioned that null pointers in C/C++ were actually not simply zero but were interpreted by the compiler to whichever allocation address was null for the platform. h... More on stackoverflow.com
🌐 stackoverflow.com
Define null pointer and its uses.
A null pointer is a pointer that does not point to any valid memory location or object. It is typically assigned the value NULL (in C/C++) or nullptr (in C++11 and later) to indicate that the pointer is intentionally not pointing to any valid data. More on askfilo.com
🌐 askfilo.com
1
November 14, 2025
Checking for null pointers when 0 is a valid address
In C, the NULL macro is implementation ... (ptr != NULL)’ badly formed for this data. Additionally, code that accidentally dereferences a null pointer and modifies the value it points to will corrupt data at address 0.... More on reddit.com
🌐 r/embedded
56
33
October 17, 2023
People also ask

What is a null pointer?
A null pointer is a special type of pointer in programming that points to no valid memory location or object. It is used to indicate that the pointer doesn’t contain a usable or meaningful memory address. Null pointers help programmers signify the absence of a value or the end of certain processes in data structures, ensuring clarity and preventing unexpected behaviors in the program.
🌐
lenovo.com
lenovo.com › home
Null Pointer in Programming – Definition, Uses, and Common Pitfalls ...
Does a null pointer have a specific value in programming languages?
Yes, the value of a null pointer is typically language-dependent, but often standardized as the integer value zero or its equivalent. For instance, in C and C++, null pointers are defined using the macro-NULL, representing zero as a pointer constant. Modern languages like C++11 and newer also introduced nullptr as a more robust null pointer constant.
🌐
lenovo.com
lenovo.com › home
Null Pointer in Programming – Definition, Uses, and Common Pitfalls ...
Can a null pointer be compared with other pointers?
Yes, null pointers can be compared to other pointers. This is a common practice to ensure that a pointer has been assigned a valid memory address. For example, checking whether a pointer is null before accessing it helps programmers avoid dereferencing errors. Such comparisons are straightforward and widely used in safe memory management.
🌐
lenovo.com
lenovo.com › home
Null Pointer in Programming – Definition, Uses, and Common Pitfalls ...
🌐
Learn C++
learncpp.com › cpp-tutorial › null-pointers
12.8 — Null pointers – Learn C++
August 12, 2015 - Besides a memory address, there is one additional value that a pointer can hold: a null value. A null value (often shortened to null) is a special value that means something has no value. When a pointer is holding a null value, it means the pointer is not pointing at anything.
🌐
GeeksforGeeks
geeksforgeeks.org › c++ › null-pointer-in-cpp
NULL Pointer in C++ - GeeksforGeeks
A NULL pointer in C++ represents a pointer that does not refer to any valid memory address. It indicates that the pointer is intentionally set to point to nothing and holds the value NULL (or nullptr in C++11 and later).
Published   January 12, 2026
🌐
Microsoft Learn
learn.microsoft.com › en-us › cpp › extensions › nullptr-cpp-component-extensions
nullptr (C++/CLI and C++/CX) | Microsoft Learn
June 25, 2025 - Use a null pointer value to indicate that an object handle, interior pointer, or native pointer type does not point to an object.
🌐
Reddit
reddit.com › r/learnprogramming › trying to understand null pointers
r/learnprogramming on Reddit: Trying to understand NULL pointers
December 30, 2021 -

Hello all again,

I have another stupid question here lol, so I'm trying to wrap my head around NULL. Im currently under the impression that NULL is a built in constant that has a value of zero, but what does that actually mean? When would it be appropriate to use null? If someone could explain it in layman's terms that would be super helpful!

Find elsewhere
🌐
Codecademy
codecademy.com › docs › pointers › null pointer
C | Pointers | Null Pointer | Codecademy
February 3, 2025 - A NULL pointer in C is a pointer that doesn’t point to any valid memory location. It acts as a special value to show that a pointer is either not initialized yet or is pointing to an invalid or unavailable memory address.
🌐
Unstop
unstop.com › home › blog › null pointer in c | a detailed explanation with examples
Null Pointer In C | A Detailed Explanation With Examples
May 3, 2024 - A NULL pointer is a pointer that doesn't point to any usable memory address. It is commonly represented by the constant "0" or by the macro "NULL," which is specified as 0 in the standard library.
🌐
Lenovo
lenovo.com › home
Null Pointer in Programming – Definition, Uses, and Common Pitfalls | Lenovo US
A null pointer functions by holding a predefined, typically zero-valued, address that does not reference any actual memory area. It acts as a sentinel value that tells the program or operating system that this pointer is inactive or uninitialized.
🌐
Tutorialspoint
tutorialspoint.com › cplusplus › cpp_null_pointers.htm
C++ Null Pointers
The NULL pointer is a constant with a value of zero defined in several standard libraries, including iostream.
🌐
ScienceDirect
sciencedirect.com › topics › computer-science › null-pointer
Null Pointer - an overview | ScienceDirect Topics
In short, black is a meaningful default, null is a meaningless but not invalid default for pointers, and Image 21 is typically an invalid default for numbers—or at least this summarizes typical usage patterns. Unpacking the conceptual variations between different type-instances—meaningful, ...
🌐
GNU
gnu.org › software › c-intro-and-ref › manual › html_node › Null-Pointers.html
Null Pointers (GNU C Language Manual)
Next: Dereferencing Null or Invalid Pointers, Previous: Dereferencing Pointers, Up: Pointers [Contents][Index] A pointer value can be null, which means it does not point to any object. The cleanest way to get a null pointer is by writing NULL, a standard macro defined in stddef.h.
🌐
Grokipedia
grokipedia.com › null pointer
Null pointer — Grokipedia
January 14, 2026 - A null pointer, also known as a null reference, is a special value in computer programming that indicates a pointer variable does not currently point to any valid object, memory location, or address.[1] It serves as a standardized way to represent ...
🌐
cppreference.com
en.cppreference.com › cpp › language › nullptr
nullptr, the pointer literal (since C++11) - cppreference.com
August 12, 2024 - The keyword nullptr denotes the pointer literal. It is a prvalue of type std::nullptr_t. There exist implicit conversions from nullptr to null pointer value of any pointer type and any pointer to member type.
Top answer
1 of 4
8

The 0xCACACACA generated by Visual Studio is usually there for un-initialized pointers, for precisely this reason. When you see this, you know something is wrong. If it initialized it to 0, it can very well be expected behavior. This is only done in debug node, with full optimization the value of an uninitialized pointer would be just garbage.

And yes, NULL pointers don't have a value of 0 per say. 0 is just a literal. The actual value can be different. But the compiler is smart enough to abstract that away, so even if you have a NULL pointer whose value isn't really 0 (as in the number 0), comparing it to 0 or NULL would still yield true. It's better to think in terms of nullptr really.

2 of 4
4

This question previously appeared on the comp.lang.c newsgroup. You can read the archive with Google Groups

In that thread, Paul Sand quoted another source, "Portable C" by H. Rabinowitz and Chaim Schaap, as follows:

Certain Prime computers use a value different from all-bits-0 to encode the null pointer. Also, some large Honeywell-Bull machines use the bit pattern 06000 to encode the null pointer. On such machines, the assignment of 0 to a pointer yields the special bit pattern that designates the null pointer.

Similarly, (char *)0 yields the special bit pattern that designates a null pointer.

Where you'd commonly see non-null pointers is when working with physical memory addresses (that is, when there is no MMU or in kernel mode bypassing the MMU) and the machine has memory-mapped I/O at or near address 0. You want a null pointer to be way out in no-man's land, so that if you offset it (e.g. structure member access via a pointer) you won't get any useful address.

For your specific question, only an integral constant expression with value 0 is interpreted as a null pointer. So

char* p = (char*)i;

does not portably make p a null pointer (i.e. the Standard makes no such guarantee, but your particular compiler may).

🌐
Scaler
scaler.com › home › topics › what is null pointer in c?
What is Null Pointer in C? - Scaler Topics
September 4, 2023 - In the C programming language, ... of any variables. It just stores the segment's base address. That is, the null pointer in C holds the value Null, but the type of the pointer is void....
🌐
TutorialsPoint
tutorialspoint.com › cprogramming › c_null_pointer.htm
NULL Pointer in C
A NULL pointer in C is a pointer that doesn't point to any of the memory locations. The NULL constant is defined in the header files stdio.h, stddef.h as well as stdlib.h. A pointer is initialized to NULL to avoid the unpredicted behavior of a
🌐
Eskimo
eskimo.com › ~scs › cclass › notes › sx10d.html
10.4 Null Pointers
We said that the value of a pointer variable is a pointer to some other variable. There is one other value a pointer may have: it may be set to a null pointer. A null pointer is a special pointer value that is known not to point anywhere.
🌐
CodeWithHarry
codewithharry.com › tutorial › c-null-pointer
NULL Pointer | C Tutorial | CodeWithHarry
A pointer that is not assigned any value or memory address but NULL is known as a NULL pointer. A NULL pointer does not point to any object, variable, or function.
🌐
Filo
askfilo.com › higher education › smart solutions › define null pointer and its uses.
Define null pointer and its uses.... | Filo
November 14, 2025 - In summary, a null pointer is a special pointer value used to indicate that the pointer does not currently point to any valid memory or object, and it is widely used for safe pointer initialization, error handling, and control flow in programming.