Re: A simple program , need to see where's the mistake :)
- From: Christopher Benson-Manica <ataru@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Oct 2006 12:51:46 +0000 (UTC)
Andrew Poelstra <apoelstra@xxxxxxxxxx> wrote:
int num, ctr;
scanf(&num);
What is this, my lord? Surely hell hath no fury like a terribly
incorrect scanf() call?
My final comment is that you shouldn't be using scanf() for user input,
as it's very unfriendly and doesn't handle erroneous input properly.
Better to write your own get_int() function using fgets() or fgetc(). I
recommend that as your next project.
And you helpfully provided an example of how *not* to use scanf() :-)
--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gmail.com | don't, I need to know. Flames welcome.
.
- Follow-Ups:
- Re: A simple program , need to see where's the mistake :)
- From: Andrew Poelstra
- Re: A simple program , need to see where's the mistake :)
- References:
- A simple program , need to see where's the mistake :)
- From: Odinn
- Re: A simple program , need to see where's the mistake :)
- From: Andrew Poelstra
- A simple program , need to see where's the mistake :)
- Prev by Date: Re: string manipulation
- Next by Date: Re: How to remove // comments
- Previous by thread: Re: A simple program , need to see where's the mistake :)
- Next by thread: Re: A simple program , need to see where's the mistake :)
- Index(es):
Relevant Pages
|