Mam pytanie odnośnie jednego przykładu martwego kodu który znalazłem w książce.
Kod: Zaznacz cały
#include <stdio.h>
#include <string.h>
void loop (char *str);
int main (void)
{
loop("STARYANODA");
return 0;
}
void loop (char *str)
{
size_t length = strlen(str);
if(length == 0) return;
for(size_t n = 0; n < length; n++)
{
if(str[n] == '\0')
{
printf("Ten kod nie zostanie uruchomiony 0 !!!");
}
}
if(length)
{
printf("Ten kod nie zostanie uruchomiony 1 !!!");
return;
}
}
W konsoli otrzymuję komunikat: "Ten kod nie zostanie uruchomiony 1 !!!" co jest dla mnie zrozumiałem i oczywiste nie wiem dlaczego autor twierdzi, że ten kod nie zostanie wykonany.