"do ... while ((NULL + 1) - 1);" -- valid C?

Doug Gwyn gwyn at smoke.BRL.MIL
Wed Aug 9 07:09:26 AEST 1989


In article <1043 at levels.sait.edu.au> ccdn at levels.sait.edu.au (DAVID NEWALL) writes:
-I've been told that this is not valid C because, in the case that there
-are no more fields (commas), strchr() returns NULL; and NULL + 1 is not
-valid.
-Comments, anyone?

You were told right.  You're not allowed to perform pointer arithmetic
involving null pointers.



More information about the Comp.lang.c mailing list