Using the following code:
char *name = malloc(sizeof(char) + 256); printf(\"What is your name? \"); scanf(\"%s\", name); printf(\"Hello %s. Nice to meet y
You can use the fgets() function to read a string or use scanf("%[^\n]s",name); so string reading will terminate upon encountering a newline character.
fgets()
scanf("%[^\n]s",name);