Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!inmet!ishmael!inmet!authorplaceholder From: porges@inmet.UUCP Newsgroups: comp.lang.c Subject: Re: C problems Message-ID: <124200016@inmet> Date: 2 Jun 89 16:20:00 GMT References: <29@ Lines: 26 Nf-ID: #R:/* Written 3:34 am May 30, 1989 by deven@rpi.edu.UUCP in inmet:comp.lang.c */ #include main(argc, argv) { [...] >This error has nothing to do with the I/O; you never declared what the >parameters rto main were, so the compiler assumed integer for both. >argc is an integer, but argv is a char **. You need to add a line >after main(argc,argv) but BEFORE the "{" which reads "char **argv;" or >"char *argv[];" (take your pick; they mean the same.) and you *should* >add right before it "int argc;" but you don't need to, since the >compiler will assume it. > Since noone else jumped in on this: char **argv and char *argv[] are NOT the same thing in delcarations. In the first case you have a pointer to a pointer to a character; you may in fact have a pointer to an array of pointer to characters. In the second case, however, you have an array of unknown size of character pointers on the argument stack. You almost certainly want char *argv[]. -- Don Porges porges@inmet.com {...mirror,ima}!inmet!porges