Originally Posted by
Linux Trojan
Unfortunately, I havent programmed in C for a long while and I just dont understand the warning messages. Any suggestions?
Yeah, start trying to understand the messages! Eg:
foo.c:13: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
You have a filename and a line number. So you know the problem is here:
Code:
fscanf(fp, "%s\n", a[i]);
Hopefully what "format ‘%s’" refers to is obvious enough (WRT scanf/printf functions, the template is sometimes called a "format string"). And the third argument is not sympatico with this format.
Deciphering compiler/interpreter errors and warnings can take practice. Remember, the primary objective of the compiler is to produce an executable; the messaging is secondary and may face limitations because of the primary objective. The messages are still useful clues, however. Always enable warnings and aim to compile without getting any.