More getch() woes

Todd Crowe n8840371 at unicorn.cc.wwu.edu
Thu Mar 14 11:03:07 AEST 1991


Ok, I'll bite.  I'm no C guru like some people are here, but I can answer this.

storm at cs.mcgill.ca (Marc WANDSCHNEIDER) writes:
>The following program WITHOUT The line #include <conio.h> does not work.  It 
>just freezes the entire system up, and I have to reboot (usin TC++ 1.0 on a
>PC).  However, when I put the #include <conio.h>> line in, it doesn't even
>compile.  I get LValue required in function main, and it  point to the line
>c = 0;            ^
                   |
                 This should give you a good clue as to what is going on.

>#include <stdio.h>
>#include <conio.h>

>main()
>{
>   int i, test, c[25];

>   i = 0;
>   c = 0;

>  (rest of code deleted) 

>Any insight...?

Yep.  c is the name of an array.  As such it is a constant value (i.e. it
is not a valid lvalue).  You are in effect trying to assign a value to a
constant.  I'm not quite sure what you are trying to do with but you need
to either make it a scalar or an array but not both.

      +++++++++++++++        "Dont get your hair in an uproar!!!"
+++++ + at +++++++++++++  +-----------------------------------------------------+
+++++ +++Western+++++  |                   Todd Crowe                        |
 +++++++Washington+++  |           n8840371 at unicorn.cc.wwu.edu               |
 +++++++University+++  |             TODDC at nessie.cc.wwu.edu                 |
  +++++++++++++++++++  +-----------------------------------------------------+
     ++++++++++                   "Innovate, don't litigate!"



More information about the Comp.lang.c mailing list