c - What are trailing blanks and tabs? K&R Exercise 1.18 -
in ex 1.18 of kernighan & ritchie's c programming language, reader asked write program remove trailing blanks , tabs, , delete entirely blank lines. meant trailing blanks , tabs? consecutive tabs or spaces trailing blanks , tabs? entirely blank line means consecutive '\n' s or "\n \n" considered blank line too?
trailing whitespace refers whitespace follows last non-whitespace character of line.
i think "\n \n" should considered blank line (that's blank vs. empty distinction used apache stringutils: empty strings have length 0, blank strings contain whitespace). you'll delete them either way, since you'd delete trailing whitespace first, leaving them empty.
Comments
Post a Comment