Re: need to compile this ( trying to find roots of a bisection)
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Sun, 26 Feb 2006 05:44:42 GMT
CBFalconer <cbfalconer@xxxxxxxxx> writes:
anand wrote:[...]
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
double a,b,c,fa,fb,fc,err;
int count;
clrscr();
It won't compile. There is no such header file as conio.h. There
is no such routine as clrscr(). main returns an int, not void. I
did not look further.
At least in C. If you are using some other language with vague
similarities to C you need to use a newsgroup that deals with that
language. This is not it.
As I'm sure you know, there is a header file called conio.h and a
function called clrscr() *on some systems*. (Of course, there's no
reason to use either in a program that just performs some mathematical
operations.)
Declaring "void main()" makes it incorrect C, not non-C.
The use of system-specific headers and functions makes the program
non-portable (and off-topic here); it doesn't make it non-C. One of
C's greatest assets is its ability to support system-specific
extensions.
What makes the program non-C is its use of "Else" and "If" rather than
"else" and "if".
--
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.
.
- Follow-Ups:
- Re: need to compile this ( trying to find roots of a bisection)
- From: Micah Cowan
- Re: need to compile this ( trying to find roots of a bisection)
- References:
- Prev by Date: Re: Way for computing random primes in standard C.
- Next by Date: Re: Whats the use of %p
- Previous by thread: Re: need to compile this ( trying to find roots of a bisection)
- Next by thread: Re: need to compile this ( trying to find roots of a bisection)
- Index(es):
Relevant Pages
|