From: Stefan Wiermann Newsgroups: comp.os.msdos.djgpp Subject: Re: I'm having some problems when using the special parameters for main() Date: Thu, 8 Jun 2000 08:41:44 +0200 Organization: Johannes Gutenberg-Universitaet Mainz, Germany Lines: 58 Message-ID: References: <01BFD0CA DOT CA780E20 AT mdm124 DOT plug-in DOT com DOT br> NNTP-Posting-Host: omalley.zdv.uni-mainz.de Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: bambi.zdv.Uni-Mainz.DE 960446502 9053 134.93.8.121 (8 Jun 2000 06:41:42 GMT) X-Complaints-To: usenet AT mail DOT uni-mainz DOT de NNTP-Posting-Date: 8 Jun 2000 06:41:42 GMT X-Sender: wiers000 AT omalley DOT zdv DOT Uni-Mainz DOT DE In-Reply-To: <01BFD0CA.CA780E20@mdm124.plug-in.com.br> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 7 Jun 2000, Marcelo Juchem wrote: > I'm having some problems when using the special parameters for main(). > Please, could you tell-me what am I doing wrong? > Thank you! > Marcelo Juchem, mj-me AT plug-in DOT com DOT br > > THE RESULTS AND SOURCE-CODE FOLLOW: > > --------------------------------------------------------------------------- > With the following command-line: gpp -o cmdline.exe cmdline.cpp > The results are: > --------------------------------------------------------------------------- > cmdline.cpp: In function `int main(int, char **)': > cmdline.cpp:11: invalid types `int[int]' for array subscript > > --------------------------------------------------------------------------- > With the following command-line: gpp -O3 -o cmdline.exe cmdline.cpp > The results are: > --------------------------------------------------------------------------- > cmdline.cpp: In function `int main(int, char **)': > cmdline.cpp:11: invalid types `int[int]' for array subscript > > --------------------------------------------------------------------------- > The following source code: > --------------------------------------------------------------------------- > #include > #include > > void waitkbd(void); > > int main(int argc,char **argv) > { > int c; > printf("\n "); > for(c=1;c printf("%s ",argc[c]); ^^^^ this should be argv, not argc, argc is an integer, not an integer array. %s in the printf-command is expecting a pointer to a string, just that what argv(c) is--an array of pointers to strings. sorry the () should be brackets, im just fighting with some keyboard setup thingies ;) > waitkbd(); > return(0); > } > > void waitkbd(void) > { > while(kbhit()) getch(); > getch(); > } >