#: 7798 S3/Languages
27-Oct-90 12:20:22
Sb: #OSK C
Fm: Jay Truesdale 72176,3565
To: all
OK, I must be confused! The C book I am using shows something like this:
while( (ch=getchar()) |='Y' && ch |='y' && ch |= 'N' && ch |= 'n')
printf("Please enter a Y or a N\n");
"ch" is defined like this:
int ch;
As I understand it, getchar returns an integer so this should be ok.
When I compile this with the MW OSK C compiler I get:
"prog9.c", line 59: **** lvalue required ****
while( (ch=getc((&_iob[0]))) |='Y' && ch |='y' && ch |= 'N' && ch |= 'n')
^
and this continues for each ocurrence of "ch" in the statement. The error
messages in the C manual state that this means that the item to the left of
the assignment operator must be able to be stored into. I thought you could
store a char into an int.
So what obvious fact am I overlooking this time?
-J
There are 3 Replies.
|