You're setting a pointer to 0 (NULL) and then adding 1 to it; then you're converting the result to an int and printing the result. The key piece of knowledge you need here is that when you increment (add 1 to) a pointer, you actually add the size of the pointed-to object -- an int pointer is advanced to point to the next int. Since int is (apparently) 4 bytes on your platform, p is incremented to point to an address 4 bytes past where it starts.

Answer from Ernest Friedman-Hill on Stack Overflow
🌐
freeCodeCamp
freecodecamp.org › news › a-quick-and-thorough-guide-to-null-what-it-is-and-how-you-should-use-it-d170cea62840
A quick and thorough guide to ‘null’: what it is, and how you should use it
June 12, 2018 - We intuitively associate a precise meaning to null. In a simple and flawless world, null would simply mean that Alice actually doesn't have an email address.
🌐
Education Ecosystem
educationecosystem.com › home › what is the null address in crypto?
What is the Null Address in Crypto? Null Address in Crypto
January 3, 2022 - Standard addresses are just a string ... On the other hand, a null address is an address created specifically to receive tokens that are being intentionally removed out of circulation....
Discussions

c - What is the value of a NULL address location? - Stack Overflow
So incrementing a pointer by one unit means incrementing it's value by sizeof(int). Also, you aren't printing the value of which pointer is directing (as this would certainly crash your program) but the value of the pointer itself. You should definitely take a look at any pointers tutorial in C (or in general). ... thanks a lot , does it really point to the first address location when we point to NULL ... More on stackoverflow.com
🌐 stackoverflow.com
June 10, 2012
c - Address of NULL pointer - Stack Overflow
So your pointer address is 0x7ff..., and its value is null, iow zero. ... Find the answer to your question by asking. Ask question ... See similar questions with these tags. ... Is the “freezing” of infalling matter at a black hole horizon purely observational, or does it have physical meaning? More on stackoverflow.com
🌐 stackoverflow.com
c - Why is NULL not a valid memory address? - Stack Overflow
In other words, the C standard does not require NULL to provide any trapping capability. It is just a value that is different from any actual pointer, provided just so you have one pointer value that means “not pointing to anything.” · General-purpose operating systems typically arrange for the memory at address ... More on stackoverflow.com
🌐 stackoverflow.com
What is Null?
This was intended as a meme but is actually a good representation of what "Null" is. In C#, when you declare string s = "My shit"; it means that "s" is a reference to a memory location that holds the data "My shit". string s = null; means that the reference "s" exists but it's not pointing to any object, as in it holds nothing. More on reddit.com
🌐 r/learnprogramming
60
34
July 5, 2024
🌐
SmallUsefulTips
smallusefultips.com › what-does-null-null-mean-in-an-email-address
The Mysterious "Null Null" in Email Addresses: Unraveling the Enigma - SmallUsefulTips
October 7, 2025 - To address this issue, developers and programmers began using “null null” as a default value to represent empty or invalid email addresses. This convention was likely adopted from programming languages, where “null” was already used to represent an empty or null value.
🌐
Chainargos
docs.chainargos.com › documentation › concept-glossary › address-types › null-address
Null Address | Concept Glossary | ChainArgos
May 13, 2024 - There is no way to prove the non-existence of your copy of the private key. Consequently the convention used for most blockchains is to use a string consisting entirely of 0s – know as the “null address” – to indicate ...
🌐
Wordtothewise
wordtothewise.com › 2019 › 09 › null-sender-address
Null sender address | Word to the Wise
September 12, 2019 - If the 5321.from is the SPF domain and there is an entire class of email that doesn’t have a 5321.from, what do we do about SPF? Never fear, the SPF spec addresses that. When the message has a null from address, the domain in the HELO is checked for a SPF record.
🌐
Quora
quora.com › In-computer-programming-what-is-the-address-of-null-in-memory
In computer programming, what is the address of null in memory? - Quora
Answer (1 of 4): If you’re talking about the value null (or NUL, or 0), a byte in which all bits are 0, any memory address could potentially point to a byte with this value. So, the address of a NUL byte could potentially be any memory address.
🌐
BitKan
bitkan.com › learn › what-is-null-address-in-crypto-is-null-address-the-same-as-vanity-address-9530
What is NULL address in crypto? Is null address the same as vanity address?
Null addresses in encryption are generated specifically to allow proof-of-burn. Token burns occur when tokens are intentionally sent to unusable wallets to remove them from circulation.
Find elsewhere
🌐
Quora
quora.com › Are-there-special-addresses-like-null-where-nothing-is-stored
Are there special addresses (like null) where nothing is stored? - Quora
Answer (1 of 3): Any address that is treated as NULL (or nullptr) by the compiler is special. Usually NULL points to address 0, but some systems have NULL point to other addresses. On Linux, NULL points to address zero.
Top answer
1 of 3
5

Dereferencing NULL is undefined behavior. Anything could happen, and most of the time bad things happen. So be scared.

Some old architectures (VAX ...) permitted you to derefence NULL.

The C11 standard specification (read n1570) does not require the NULL pointer to be all zero bits ( see C FAQ Q5.17); it could be something else, but it should be an address which is never valid so is not obtainable by a successful malloc or by the address-of operator (unary &), in the sense of C11. But it is more convenient to have it so, and in practice most (but not all) C implementations do so.

IIRC, on Linux, you might mmap(2) the page containing (void*)0 with MAP_FIXED, but it is not wise to do so (e.g. because a conforming optimizing compiler is allowed to optimize dereference of NULL).

So (void*)0 is not a valid address in practice (on common processors with some MMU and virtual memory running a good enough operating system!), because it is convenient to decide that it is NULL, and it is convenient to be sure that derefencing it gives a segmentation fault. But that is not required by the C standard (and would be false on cheap microcontrollers today).

A C implementation has to provide some way to represent the NULL pointer (and guarantee that it is never the address of some valid location). That might even be done by a convention: e.g. provide a full 232 bytes address space, but promise to never use address 0 (or whatever address you assigned for NULL, perhaps 42!)

When NULL happens to be derefencable, subtile bugs are not caught by a segmentation fault (so C programs are harder to debug).

Couldn't I invent a new architecture where the memory address 0 is accessible to processes?

You could, but you don't want to do that (if you care about providing any standard conforming C implementation). You prefer to make address 0 be the NULL. Doing otherwise make harder to write C compilers (and standard C libraries). And make that address invalid to the point of giving a segmentation fault when derefencing make debugging (and the life of your users coding in C) easier.

If you dream of weird architectures, read about Lisp machines (and Rekursiv, and iapx 432) and see The circuit less traveled talk at FOSDEM2018 by Liam Proven. It really is instructive, and it is a nice talk.

2 of 3
2

Making address zero unmapped so that a trap occurs if your program tries to access it is a convenience provided by many operating systems. It is not required by the C standard.

According to the C standard:

  • NULL is not be the address of any object or function. (Specifically, it requires that NULL compare unequal to a pointer to of any object or function.)
  • If you do apply * to NULL, the resulting behavior is not defined by the standard.

What this means for you is that you can use NULL as an indicator that a pointer is not pointing to any object or function. That is the only purpose the C standard provides for NULL—to use is tests such as if (p != NULL)…. The C standard does not guarantee that if you use *p when p is NULL that a trap will occur.

In other words, the C standard does not require NULL to provide any trapping capability. It is just a value that is different from any actual pointer, provided just so you have one pointer value that means “not pointing to anything.”

General-purpose operating systems typically arrange for the memory at address zero to be unmapped (and their C implementations define NULL to be (void *) 0 or something similar) specifically so that a trap will occur if you dereference a null pointer. When they do this, they are extended the C language beyond what the specification requires. They deliberately exclude address zero from the memory map of your process to make these traps work.

However, the C standard does not require this. A C implementation is free to leave the memory at address zero mapped, and, when you apply * to a null pointer, there might be data there, and your program could read and/or write that data, if the operating system has allowed it. When this is done, it is most often in code intended to run inside the operating system kernel (such as device drivers, kernel extensions, or the kernel itself) or embedded systems or other special-purpose systems with simple operating systems.

🌐
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 - Null and void are related concepts in programming but are not the same. Null: In programming, null typically refers to a special value that represents the absence of a valid or meaningful object or reference.
🌐
Reddit
reddit.com › r/embedded › checking for null pointers when 0 is a valid address
r/embedded on Reddit: Checking for null pointers when 0 is a valid address
October 17, 2023 -

In some MCUs, 0 is a valid address where data may be stored. In C, the NULL macro is implementation defined but typically set to ‘0’ or ‘(void*)0’. In these cases, a pointer to a variable at address 0 compares equal to NULL. This makes NULL pointer checks like ‘assert (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.

Is the only portable solution to use an MPU to set a region around address 0 to cause a bus fault when read or modified? If so, what’s a good rule of thumb on the amount of bytes for this region to be?

Also, in C++ and C23 does the nullptr keyword prevent this kind of issue? Thanks

Edit: My chip is a Cortex M7 that has up to 512 KB of tightly coupled memory (TCM) for instructions and data at address 0. TCM isn’t able to be moved to any other address. Unlike with other MCUs, address 0 is not flash. This is the NXP MIMXRT1064 for anyone wondering.

🌐
Reddit
reddit.com › r/mercari › going to ship something out but the word “null” was under the buyers address, is it fine to ship out with the label like that ?
r/Mercari on Reddit: going to ship something out but the word “null” was under the buyers address, is it fine to ship out with the label like that ?
October 29, 2022 - It’s fine, I had the same thing show up twice this month with buyers addresses. Mercari also changed their tracking system, and I’m assuming it’s a placeholder for a lack of apartment number or second line in the address field. Both buyers received their packages, and all was perfectly fine.
🌐
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!

🌐
Quora
quora.com › What-does-NULL-mean-in-programming-languages
What does NULL mean in programming languages? - Quora
Answer (1 of 6): null is the pointer or reference to address zero. Why would this be needed or used? Let’s say you are searching for a library book that you want to read. Unlike Amazon, your library doesn’t have every book.
🌐
Scaler
scaler.com › home › topics › what is null pointer in c?
What is Null Pointer in C? - Scaler Topics
September 4, 2023 - A null pointer is a special reserved value declared in a header file called stddef. Null indicates that the pointer is pointing to the first memory location. meaning that 0th location.