On Wed, Mar 3, 2010 at 6:21 PM, John <[email protected]> wrote: > --- In [email protected], "Jalpan" <jalpan3...@...> wrote: >> >> char ch[100]; >> while ( ch!='\n') > > In addition to the problems Rick mentions, when you first test ch, it hasn't > been initialised. Hence it probably isn't holding the newline character, and > the loop stops. > > One solution is something like: > > while ((ch = getch()) != '\n')
All of which is ignoring the fact that getch() returns an int (for out-of-bound values such as EOF.) so even the attempted type of ch is wrong. <http://www.cprogramming.com/faq/cgi-bin/smartfaq.cgi?answer=1045691686&id=1043284392> -- PJH http://shabbleland.myminicity.com/env http://www.chavgangs.com/register.php?referer=9375
