Is there a regular expression to detect a valid regular expression? (2008)
stackoverflow.com1 pointsby bookface1 comments
foo foos[255];
int ct = 0;
if (<condition for adding first element>)
foos[ct++] = foo1;
if (<condition for adding second element>)
foos[ct++] = foo2;
...
for (int i = 0; i < ct; i++) {
/* do something with foos[i] */
}
IMHO, this is more concise and readable than separating the increment and assignment into two lines.