We can easily limit the length of the input accepted by scanf:
char str; scanf("%100s", str);
Is there any efficient way to find out that the string was trimmed? We could, for example, report an error in such case.
We could read
char strx and check with
strlen() but this involves extra cost.