Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5945925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:45:00+00:00 2026-05-22T16:45:00+00:00

I am reading The practice of programming and it says that a standard loop

  • 0

I am reading “The practice of programming” and it says that a standard loop for walking along a list in C is:

for (p=list;p != NULL;p=p->next)
...

My question is how does NULL work? I myself have used this in programs, but never paused to ponder over how it works.

I suppose, NULL must be a standard macro defined in a very basic header file like stdio.h
but what it is defined as? Is it?

#define MACRO 0  

here how does 0 work when we compare a pointer to 0. This 0 could be a valid memory address 0, then how do we distinguish to say that we actually mean invalid address i.e. the pointer has a logical empty value?

Thanks,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T16:45:01+00:00Added an answer on May 22, 2026 at 4:45 pm

    It’s defined as 0, yes. The thing is that 0 is not a valid memory address; computers are actually put together such that trying to access that address is an error.

    Try running this program on your machine, if you want to insist that 0 is a legal address:

    #import <stdio.h>
    
    int main() {
      int *p = 0;
      printf("No read error: %d\n", *p);
      *p = 1;
      printf("No write error either\n");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm reading programming best practices and it is said that when creating a function
Reading some articles, told me that soft keys varies between devices. Some says -6
I was reading the C Standard the other day, and noticed that unlike signed
I'm learning C++ and the book I'm reading (The C++ Programming Language) says to
I am reading Bjarne Stroustrup's Programming : Principles and Practice Using C++ In the
I am reading Java concurrency in practice and the below examples are from that.
I have been reading a lot of articles lately about programming practice, design and
I'm reading Stroustrup's Programming: Principles and Practice and came across this code: int main()
I was reading the article Java theory and practice: Building a better HashMap that
I was reading that using anonymous functions in javascript is bad practice, because it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.