s[] skips reading,and s[] has only "\n"Code:#include <stdio.h> #include <string.h> int main() { int n; char s[30]; scanf("%d",&n); fgets(s,sizeof(s),stdin); printf("n=%d s=%s",n,s); getch(); return 0; }
how avoid this?(s I want to also contain spaces,so read s[] with scanf is not a solution)