Giustissimo!! Perfettamente ragione.
Comunque, visto che le varie funzioni sembrano funzionare bene nei vari test, quello che dovrebbe dare problemi, per esclusione, è il main, che mi genera un errore di segmentazione.
Ho provato a modificarlo in questo modo
codice:
int main()
{
/* prova()
int prova(void);
prova();
*/
char *word[MAX_WORDS];
struct key *p;
while (getword(*word, MAX_CHARS) > 0)
{
if ( (p = binsearch(*word, keytab, MAX_KEYS)) != NULL)
p->count++;
word++; //error: lvalue required as increment operand
}
for (p = keytab; p < keytab + MAX_KEYS; p++)
if (p->count > 0)
printf("Word: %s appears %d times\n", p->word, p->count);
return 0;
}
Tuttavia ottengo quell'errore segnalato nel codice quando vado a incrementare word. Perchè?