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
Try
char str[11]; scanf("%10[0-9a-zA-Z ]", str);
Hope that helps.