🌐
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
🌐
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
Discussions

Why do we use Null pointers?
The value where a null pointer is pointing is irrelevant. A null pointer is a pointer that is pointing nowhere--there is no value. In C, the number 0 was defined as the representation of the null pointer. They could have picked any number, but it would have been painful. More on reddit.com
🌐 r/C_Programming
56
0
August 30, 2024
what is a null pointer in c - Stack Overflow
I tried looking online but I didn't know exactly what to type. The Google search results I got for 'NULL pointer' were different from what I expected. ... There is also a typo in n2.next = &n2;, meaning that we will never reach n3. I would just throw this bad example away and study some other code. More on stackoverflow.com
🌐 stackoverflow.com
c - Is NULL a pointer? - Stack Overflow
Learn more about Collectives ... Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Save this question. Show activity on this post. So, I had an argument with my professor earlier defending that NULL is not a pointer, but he kept on insisting ... More on stackoverflow.com
🌐 stackoverflow.com
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
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
June 13, 2026 - Programs routinely use null pointers ... can be compared to nullable types and to the Nothing value in an option type. A null pointer should not be confused with an uninitialized pointer: a null pointer is guaranteed to compare unequal to any pointer that points to an ...
🌐
Codecademy
codecademy.com › docs › pointers › null pointer
C | Pointers | Null Pointer | Codecademy
February 3, 2025 - A NULL pointer in C is a pointer that does not point to any valid memory location.
🌐
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 - We'll delve into what null pointers ... stores the memory address of another variable. A NULL pointer is a pointer that doesn't point to any usable memory address....
🌐
Uncodemy
uncodemy.com › blog › null-pointer-in-c-and-c-plus-plus-meaning-and-usage
Null Pointer in C and C++: Meaning and Usage
1 month ago - So, instead of holding an actual value like an integer or a character, it holds the location in memory where the value is stored. Now, a null pointer is a special type of pointer that doesn’t point to any memory location.
Find elsewhere
🌐
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, a null pointer is a pointer that does not point to any memory location and hence does not hold the address 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.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › c programming tutorial › null pointer in c
Null pointer in C | How Null pointer work in C with Examples
March 28, 2023 - So the null pointer is defined as the pointer that is assigned to zero to make it null pointer or a pointer that does not store any valid memory address or an uninitialized pointer are known as a NULL pointer.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
W3Schools
w3schools.com › c › c_null.php
C NULL
C Examples C Real-Life Examples C Exercises C Quiz C Code Challenges C Practice Problems C Compiler C Syllabus C Study Plan C Interview Q&A ... NULL is a special value that represents a "null pointer" - a pointer that does not point to anything.
🌐
Dot Net Tutorials
dotnettutorials.net › home › null pointer in c
Null Pointer in C Language with Examples - Dot Net Tutorials
November 16, 2023 - In C programming, a null pointer is a pointer that does not point to any valid memory location. It’s a special type of pointer used to indicate that it is not intended to point to an accessible memory location.
🌐
WsCube Tech
wscubetech.com › resources › c-programming › null-pointer
Null Pointer in C Language (Uses, Best Practices, Examples)
July 27, 2026 - Learn in this tutorial about the null pointer in C, including its syntax, uses, how to check it, best practices, and examples to write efficient programs.
🌐
Javatpoint
javatpoint.com › null-pointer-in-c
Null Pointer in C - javatpoint
Null Pointer in C with programming examples for beginners and professionals covering concepts, control statements, c array, c pointers, c structures, c union, c strings and more.
Top answer
1 of 3
4

In C, NULL is a macro that expands to a null pointer constant.

7.19p3

The macros are

NULL which expands to an implementation-defined null pointer constant; ...

A null pointer constant is an integer constant expression with the value 0 ( e.g., 0, 1-1, 42*0LL, etc.) or such an expression cast to (void*).

6.3.2.3p3

An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.66) If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function.

Most common C implementations define NULL to be 0, 0L, or ((void*)0).

So you are correct. NULL need not be a pointer.

(IIRC, C++ doesn't even allow the (void*) cast in NULL, meaning NULL in C++ always has integer type. Because of that and because void* pointers do not compare with regular pointers so readily in C++, C++>=11 now has a special nullptr keyword.)

2 of 3
3

NULL itself is not a pointer, it is a macro that can be used to initialize a pointer to the null pointer value of its type. When compared to a pointer, it compares equal if the pointer is a null pointer and unequal if the pointer is a valid pointer to an object of its type.

There is no semantic difference between char *p = 0; and char *p = NULL; but the latter is more explicit and using NULL instead of 0 is more informative in circumstances where the other operand is not obviously a pointer or if comparing to an integer looks like a type mismatch:

FILE *fp = fopen("myfile", "r");
if (fp == NULL) {
    /* report the error */
}

Similarly, there is no semantical difference in C between '\0' and 0, they both are int constants. The first is the null byte, the second the null value. Using 0, '\0' and NULL wisely may seem futile but makes code more readable by other programmers and oneself too.

The confusion may come from misspelling or mishearing the null pointer as the NULL pointer. The C Standard was carefully proof read to only use null pointer and refer to NULL only as the macro NULL.

Note however that one the accepted definitions of NULL, #define NULL ((void*)0) makes NULL a null pointer to void.

🌐
Lysator
lysator.liu.se › c › c-faq › c-1.html
Null Pointers
A null pointer is conceptually different from an uninitialized pointer. A null pointer is known not to point to any object; an uninitialized pointer might point anywhere. See also questions 3.1, 3.13, and 17.1. As mentioned in the definition above, there is a null pointer for each pointer type, and the internal values of null pointers for different types may be different.
🌐
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. NULL pointers are often used to initialize a pointer variable, where we wish to represent that the pointer variable isn’t currently ...
🌐
PREP INSTA
prepinsta.com › home › all about c language › null pointer in c
Null Pointer In C
January 17, 2023 - Null Pointer in C doesn’t point to any memory location. While void is the pointer’s type, the null pointer essentially holds the Null value.
🌐
Aticleworld
aticleworld.com › home › what is a null pointer in c/c++?
What is a Null Pointer in C/C++? - Aticleworld
January 25, 2023 - In C/C++ programming a null pointer is guaranteed to compare unequal to a pointer to any object or function; that means (ptr1 == ptr2) is false. And any two null pointers will be equal which means ptr1 == ptr2 is true.
🌐
LabEx
labex.io › tutorials › c-using-null-pointer-in-c-programming-123293
Using Null Pointer in C Programming
A null pointer is a pointer that does not point to any memory address. In C programming, a null pointer is represented by the constant NULL, which is defined in the header file stdio.h.