Dynamically allocate user inputted string
问题 I am trying to write a function that does the following things: Start an input loop, printing '> ' each iteration. Take whatever the user enters (unknown length) and read it into a character array, dynamically allocating the size of the array if necessary. The user-entered line will end at a newline character. Add a null byte, '\0' , to the end of the character array. Loop terminates when the user enters a blank line: '\n' This is what I've currently written: void input_loop(){ char *str =