I think the problem is that printf()
buffers output until either
- it gets a line ending (
\n
) - you
fflush(stdout)
- you close the stream (including it closing automatically when the program exits)
See if the following makes more sense
printf("Type a string ");
fflush(stdout);
fgets(string, max_size_string, stdin);
printf("The string is %s\n",string); // << Note I've added a line ending
return 0;