How can I check that a char
array is null terminated?
char input[80];
fgets(input, sizeof(input), stdin);
for (i = 0; input[i]; i++)
{
if (input[i] == '\0') {
printf("null!!!"); // never works
}
}
For example, the below code does not print null
.