Is '(NULL + 1) - 1' valid C?

Oren L. Stern nero at eng.umd.edu
Sat Aug 12 07:40:52 AEST 1989


Assuming that "NULL + 1" is non-portable C, I am now wondering if it's
valid to use NULL as an expression.  For example, is it valid to write:

  for (ptr = head; ptr; ptr = ptr->next) {...}

to traverse a linked list?  If not, I've got a lot of "portable" code
to rewrite...:-)


Oren Stern  (nero at hellcat.eng.umd.edu)



More information about the Comp.lang.c mailing list