Answer the question
In order to leave comments, you need to log in
Why is only the first word printed from scanf() to printf() in C?
#include <stdio.h>
#include <stdlib.h>
int main() {
char name[1024];
printf("Your name: ");
scanf("%s", &name);
printf("Hello, %s!\n", name);
system("pause");
return 0;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question