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 8464971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:54:34+00:00 2026-06-10T14:54:34+00:00

Another question about the C standard. I have tested this and I always get

  • 0

Another question about the C standard. I have tested this and I always get NULL < ptr true, where ptr is any pointer different from NULL. But I know that the Standard says that pointer arithmetic and comparison is only defined inside the bounds of an array. I’m just not sure if the particular comparison NULL < ptr is legal.

Edit: I have been reading K&R and I found the following quote:

Any pointer can be meaningfully compared for equality or inequality with zero. But the behavior is undefined for arithmetic or comparisons with pointers that do not point to members of the same array.

I’m not sure if this affects the answers already given to this question. In any case, I am still unsure whether p > NULL is always guaranteed or not to return true, where p is a pointer !=NULL.

  • 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-06-10T14:54:35+00:00Added an answer on June 10, 2026 at 2:54 pm

    NULL < ptr is invalid: a null pointer cannot be relationally compared. To do so yields undefined behavior.

    You are correct that you can only relationally compare pointers that point into the same object (either to elements in an array or subobjects of an aggregate). Since a null pointer does not point at any object, you can’t relationally compare it with anything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have another simple question about Node. I'm trying to make a simple http
i have another (probably unanswered) question about map views. I have a map view
I have seen a question on here about this however it was old so
Answering another question about how const string data was stored in an executable a
By refering to Another Question About ActiveX freezes IE , I wrote an Active
I've recently made another question about connecting to MS-ACCESS database with .NET in C#
I made another question about two weeks ago with having trouble with the Circle
I was trying to answer another question about polymorphism vs sharing when I stumbled
Note: I had another similar question about how to GZIP data using Ruby's zlib
Another question of mine about optimizing Objective C programs inspired the following: does anyone

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.