Timeline for Initials, more: Can't get it to loop back after 1 letter
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 15, 2017 at 16:23 | comment | added | Blauelf |
You could also have like for (pos=0; pos < strlen(nms); pos++) { if ((pos == 0 || isspace(nms[pos - 1])) && isalpha(nms[pos])) { putchar(toupper(nms[pos])); }} without the need for testing nms[0] separately. If pos == 0 , the nms[pos-1] part isn't even evaluated as || short-circuits.
|
|
Nov 15, 2017 at 15:39 | comment | added | contranull | Now it makes sense! Thank you! I went with if (isspace(nms[pos]) && isalpha(nms[let])) for the sleeker design. Since I thought maybe someone would start with spaces, I had the program print the first character to start with, if it's an alpha. | |
Nov 15, 2017 at 15:39 | vote | accept | contranull | ||
Nov 15, 2017 at 15:30 | history | answered | Blauelf | CC BY-SA 3.0 |