The structured version of the function is easily modified to meet the new requirements.
int countPunct( char *p ) { count = 0; while ( p ) { if ( ispunct( *p ) ) count++ ; p++ ; } return count; }
Actually, with this tiny function, both versions are easily modified to meet the changed requirements. But revisions might be difficult if you had a longer function with several early returns. One of the advantages of structured programming is that changes are more easily made than with poorly structured code. The advantages of early returns might be offset by difficulty in making revisions.
If early returns are sometimes OK in a loop, what about continue
?