1. Empty input buffer with fflush (stdin)
2.gets (): Gets a row, until it encounters a newline
example:
#include <stdio.h> #include <Windows.h> int main(void) { char name[16]; char addr[64]; printf ( " ? Yoshina girl \ the n- " ); scanf("%s", name); // At this time, the input buffer and a carriage // clear the input buffer fflush (stdin); printf ( " ? girl who lives where \ the n- " ); the gets (addr); // read a line, including spaces in a row printf ( " who lives in the% s% s, I like you and \ the n-! " , addr, name); system("pause"); return 0; }