How do I read a whole line in C?

  • Thread starter Whovian
  • Start date
  • Tags Tags
    Line
1 reply · 4K views · last reply
Whovian
Messages
651
Reaction score
3
Code:
#include <stdio.h>

int main()
{
    char name[256];
    printf("What's your name?\n");
    scanf("%s",name);
    printf("Hello, %s%s",name,"!");
}

This only reads the first word of the name inputted. Is there any way to get a whole line?