/**************************************************************************** * string2.c * * Computer Science 50 * David J. Malan * * Prints a given string one character per line. * * Demonstrates strings as arrays of chars with slight optimization. ***************************************************************************/ #include #include #include int main(void) { // get line of text string s = GetString(); // print string, one character per line if (s != NULL) { for (int i = 0, n = strlen(s); i < n; i++) { printf("%c\n", s[i]); } } }