svata wrote:
Richard Heathfield wrote:
.... snip ...
>
>2) avoid scanf until you're an expert; if your teacher requires
its use, plague him mercilessly with questions about it until it
becomes apparent that he doesn't understand it either;
Can you explain me why should I refrain from using scanf()? Is that
function cursed or what? I see real difference in using gets() of
fgets(). But Borland C compiler gives no warning about using gets...
In reverse order, no warning is required for gets avoidance, just
common sense, because it cannot be used safely. You can use my
ggets instead (see url below).
Yes, scanf is cursed, especially for interactive use. The only
sane way to use it is for one item at a time, carefully checking
its return value. Unless your name is Dan Pop.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home .att.net>