Re: here is some problem in structures



Chris Dollin <kers@xxxxxxxxxx> writes:
ashu wrote:

lets take a look at the following code:-


#include<stdio.h>
#include<conio.h>

Nonstandard header. Avoid.

[snip]

clrscr();

Nonstandard function. Also pointless. Avoid.

[snip]

getch();

Non-standard function. Avoid.

I would place a slightly different emphasis on that. Non-standard
headers and functions should be avoided *unless* there's a good reason
to use them. They should also be avoided in code posted to this
newsgroup.

There's nothing wrong with using non-standard features *when it's
necessary*.

In this case, though, it's really not necessary. There's no standard
and portable way to clear the screen (there may not be a screen), but
there's no need for this program to clear the screen at all. Programs
that clear my screen unnecessarily are seriously annoying; that's *my*
information being erased. Likewise, if you need to wait for user
input before terminating the program, a call to the standard getchar()
should work as well as the non-standard getch(). I think getch() will
return without waiting for a newline, but that's not a good enough
reason to use it in this case.

--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
.



Relevant Pages