More getch() woes

Jim Giles jlg at cochiti.lanl.gov
Tue Mar 26 03:27:12 AEST 1991


In article <1991Mar25.145517.3427 at viewlogic.com>,
sparks at power.viewlogic.com (Alan Sparks) writes:
|> 
|> In article <669422030.1 at opocus.Fidonet.Org> you write:
|> >Marc WANDSCHNEIDER writes to All: 
|> > [...]
|> >    int i, test, c[25];
|> >    i = 0;
|> >    c = 0;
|>      ^^^^^^
|> THIS LINE SHOULD NOT COMPILE!
|> [...]
|> If your compiler let you do the above marked line, it's a bit brain-
|> damaged... the standard (either one) does not sanction assignment to
|> arrays.  Initialization of c[] here should be do with a for loop.

The program as written is wrong.  But you shouldn't need a for loop.
Why not do: 

   int i = 0;
   int c[25] = {0};
   int test;

This should do what you want in both K&R and ANSI compliant code.

J. Giles



More information about the Comp.lang.c mailing list