Re: A simple program , need to see where's the mistake :)



On Thu, 2006-10-26 at 12:51 +0000, Christopher Benson-Manica wrote:
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?


Oops! I meant
scanf("%d", &num);

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() :-)


:-}

--
Andrew Poelstra <http://www.wpsoftware.net/projects/>

.



Relevant Pages

  • Re: A simple program , need to see wheres the mistake :)
    ... What is this, my lord? ... Surely hell hath no fury like a terribly ... incorrect scanf() call? ...
    (comp.lang.c)
  • Re: Borscht
    ... Ashkanazi Jews as a sub group of the population have the ... "Hell hath no fury ... ...
    (rec.food.cooking)
  • Re: Unnecessarily Weird Blade
    ... I always figured the most misquoted was, "Hell hath no fury like a ... "Heaven has no rage like love to hatred ... turned, Nor hell a fury like a woman scorned" from the play, ... Posted via a free Usenet account from http://www.teranews.com ...
    (rec.knives)
  • Re: 50 great hip-hop album covers
    ... Clipse - Hell Hath No Fury ... Organized Konfusion - Stress... ...
    (rec.music.hip-hop)
  • DO NOT EVER CROSSPOST TO ALT.USENET.KOOKS
    ... But you would say that, wouldn't you, Roger? ... Hell hath no fury like an imposter scorned. ... See the header. ...
    (rec.music.classical.recordings)