| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Dan Nelson | Date: | August 23 1999 3:50am |
| Subject: | Re: trailing comma in delete statement | ||
| View as plain text | |||
In the last episode (Aug 22), Paul DuBois said: > At 10:15 PM -0700 8/22/99, Mick Hanna wrote: > >im calling a loop like so: > > > >printf("%s,",rmid[i]); > > You have to know when you're printing the last item in your list, > and don't print the trailing comma when you reach that item. A better way is to _prepend_ the comma, but not for the first element: for (i = 0; i < numitems; i++) { printf("%s%s", (i > 0) ? "," : "", rmid[i]); } That way the special case is the "first element?" case instead of the "last element?" case. -- Dan Nelson dnelson@stripped
| Thread | ||
|---|---|---|
| • trailing comma in delete statement | Mick Hanna | 22 Aug |
| • Re: trailing comma in delete statement | Mark Maggelet | 22 Aug |
| • Re: trailing comma in delete statement | Jeff Urban | 22 Aug |
| • Re: trailing comma in delete statement | Thimble Smith | 22 Aug |
| • Re: trailing comma in delete statement | Scott Hess | 23 Aug |
| • Re: trailing comma in delete statement | Paul DuBois | 23 Aug |
| • Re: trailing comma in delete statement | Dan Nelson | 23 Aug |
| • Re: trailing comma in delete statement | Michael Widenius | 27 Aug |
| • Re: trailing comma in delete statement | Jesse | 22 Aug |
| • Re: trailing comma in delete statement | Alok K. Dhir | 22 Aug |
| • Re: trailing comma in delete statement | Anthony Mendoza | 23 Aug |
| • Re: trailing comma in delete statement | James Manning | 23 Aug |
| • Re: trailing comma in delete statement | Anthony Mendoza | 23 Aug |
