Only you can know what length is sufficient for your needs.
If there is a limited set or range of valid inputs, you can use the length of the maximum valid input + 1.
If there isn't a limit to the maximum valid input, either you need to decide that your program doesn't support input longer than X and set that as the limit, or implement reading in a loop into a dynamically growing buffer (e.g., using realloc
as needed).
And always remember to limit the maximum allowed input length when reading, so that it's not possible to overflow your buffer with excessive input. (Using fgets
is often the simplest to get right.)