Re: "Mastering C Pointers"....

From: Keith Thompson (kst_at_cts.com)
Date: 11/05/03


Date: Wed, 05 Nov 2003 21:36:29 GMT

Sheldon Simms <sheldonsimms@yahoo.com> writes:
[...]
> A null pointer constant is not a pointer at all. It first becomes a
> (null) pointer after conversion to a pointer type.

A null pointer constant is a syntactic entity, a construct in C source
code. A null pointer is a value that can exist at run time. They
have much the same relationship as an identifier and an object, or the
consecutive characters '4' and '2' in your foo.c file and the bits
representing the integer 42 in your running program.

-- 
Keith Thompson (The_Other_Keith) kst@cts.com  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center           <*>  <http://www.sdsc.edu/~kst>
Schroedinger does Shakespeare: "To be *and* not to be"


Relevant Pages

  • Re: 0, NULL and variadic functions
    ... and a null pointer constant at the same time (with or without ... null pointer constant, without having pointer type. ... The integer constant 0 is specifically of type int; ... the conversion is performed *by the assignment*. ...
    (comp.lang.c)
  • Re: NULL with representation other then all bits 0
    ... >> I believe this has been added as a requirement in C99. ... expression cast to type void *, is called a null pointer constant. ... It says what the result of a conversion from an integer type ...
    (comp.lang.c)
  • Re: NULL with representation other then all bits 0
    ... > expression cast to type void *, is called a null pointer constant. ... An integer may be converted to any pointer type. ... It says what the result of a conversion from an integer type ...
    (comp.lang.c)
  • Re: does a program work in all cases?
    ... A null pointer constant has whatever type it has as an expression. ... long int, etc.), or "such an expression cast to type void*", which has ... the result of the conversion is of type double*. ...
    (comp.lang.c)
  • Re: Null pointers
    ... except in the case of converting a null pointer constant to ... Remember that a null pointer constant is a source ... You're right that the language doesn't require the conversion to be ... Conversion of int zero does not yield a null pointer ...
    (comp.lang.c)