For Programmers: Free Programming Magazines  


Home > Archive > C > May 2007 > Re: HELP!! Two questions from <<the c programming language>>









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: HELP!! Two questions from <<the c programming language>>
Chris Dollin

2007-05-31, 7:57 am

Tak wrote:


(fx:hint (fx:snipped-signature))
[color=darkred]
> No, I think you are misunderstanding.
> It's not homework;
>
> I can't work out Exercise 1-9.
> My code of Exercise 1-10 is like this:
>
> #include <stdio.h>
>
> main()
> {
> char c;


/int/ c.

> while ((c = getchar()) != EOF)


`getchar` returns an `int`, because it must be able to return
every character value /and one more/, viz EOF. (Yes, this
presents problems on systems where `sizeof(int) == sizeof(char)`.)

> I don't know whether it's right or not?


Does it pass your test cases?

--
"You've spotted a flaw in my thinking, Trev" Big Al,/The Beiderbeck Connection/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com