Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!ernie.viewlogic.com!news From: sparks@power.viewlogic.com (Alan Sparks) Newsgroups: comp.lang.c Subject: Re: More getch() woes Message-ID: <1991Mar25.145517.3427@viewlogic.com> Date: 25 Mar 91 14:55:17 GMT References: <669422030.1@opocus.Fidonet.Org> Sender: news@viewlogic.com (News Administrator) Organization: Viewlogic Systems, Inc., Marlboro, MA Lines: 47 In article <669422030.1@opocus.Fidonet.Org> you write: >Marc WANDSCHNEIDER writes to All: > > The following program WITHOUT The line #include does not > work. It just freezes the entire system up, and I have to reboot (usin TC++ > > #include > #include > > main() > { > int i, test, c[25]; > > i = 0; > c = 0; ^^^^^^ THIS LINE SHOULD NOT COMPILE! > > while ((i < 25) || (test !='A')) { > test = getch(); > c[i++] = test; > } > printf("\n\n %s", c); > return 0; > } > > Any insight...? > >-------------------------------- >I get the same result (Lvalue required) with or without includeing conio.h. > > > * Origin: Point No Point (Lebanon, IN) (1:231/270.3) 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. -Alan -- Alan Sparks voice: (508) 480-0881 Internet: sparks@viewlogic.com VIEWlogic Systems Inc., 293 Boston Post Rd. W., Marlboro MA 01752 Disclaimer: VIEWlogic didn't say this; I might have. Who's asking?