You are faced with a specific problem with scanf () and% s - what happens when you don't know how much input there is?
char mystring[0];, . segfault. 0, , - , ( ) - segfault.
, 1: . (, ), char mystring[0], char *mystring.
, scanf, "% s" - - . :
char mystring[512];
scanf("%s", mystring);
511 ( 512th -\0), . :
scanf("%511s", mystring);
, , C , , . , .
- fgets().
:
while (fgets(mystring, 512, stdin))
{
}
sscanf() mystring
5. , 4 , , . "" , fgets().
- , (, 10 ).