Path: utzoo!utgpu!watmath!att!pacbell!ames!uhccux!munnari.oz.au!mimir!hugin!augean!sirius!nt!levels!ccdn From: ccdn@levels.sait.edu.au (DAVID NEWALL) Newsgroups: comp.lang.c Subject: "do ... while ((NULL + 1) - 1);" -- valid C? Message-ID: <1043@levels.sait.edu.au> Date: 7 Aug 89 14:20:31 GMT Organization: Sth Australian Inst of Technology Lines: 17 I want to scan a string with fields separated by commas. To do this, I wrote the following: do ... while ((s = strchr(s, ',') + 1) - 1); 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? David Newall Phone: +61 8 343 3160 Unix Systems Programmer Fax: +61 8 349 6939 Academic Computing Service E-mail: ccdn@levels.sait.oz.au SA Institute of Technology Post: The Levels, South Australia, 5095