Mail Archives: djgpp/1998/11/05/02:20:30
On 5 Nov 1998, The zr0 wrote:
> char *main(int argc, char *argv[]) {
Bug no.1: `main' should return an int, like this:
int main(int argc, char *argv[])
> for(count=2;count<argc;count++)
Bug no.2: arguments begin with argv[1], not argv[2] (argv[0] is the
program's pathname).
> count++;
> show_file(count,argv);
Bug no.3: you increment count *before* calling show_file, so you
actually begin with argv[3], and the last argument passed is
argv[argc], which is a NULL pointer.
- Raw text -