|
-
November 9th, 2012, 01:27 AM
#1
C: getchar
hi,
once again i hit a very simple problem i am unable to resolve. I using Visual Studio 2010, but am compiling for C.
THis:
Code:
char i=45;
while(i=getchar() != EOF)
{
should imo work perfectly (yes, no real code, just to demonstrate the issue), but it doesnt. Getchar() always returns 0x01. Why is that?
This, in contrast, works perfectly fine:
Code:
char i=45;
while(i!= EOF)
{
i=getchar();
Shouldnt an assignment always return the assigned value?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|