Re: need to compile this ( trying to find roots of a bisection)



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.
.



Relevant Pages

  • Re: Execution Problem w/memory object
    ... >> rather than void main. ... >> promoting the void mainapproach, without even mentioning the int ... Online tutorial aren't a good way to learn the language. ... compiler raises a warning but does allow program execution. ...
    (comp.lang.cpp)
  • Re: Interesting problem dynamically forming func names ??
    ... int foo; ... void bar; ... There aren't any generic function pointers in C (void * can stand only ...
    (comp.lang.c)
  • Re: Is It UB ??
    ... >> a signed int or an unsigned int. ... is not a C++ header file as defined by the language. ... It would be a big surprise if it wasn't ...
    (alt.comp.lang.learn.c-cpp)
  • Re: not null
    ... > Bill Seurer wrote: ... It's neither part of the C nor of the C++ language. ... void f(int); ...
    (comp.lang.cpp)
  • Re: Function prototype vs implementation mismatch in C++
    ... there would be to inform the user of the API (header file). ... void display(const int); ... reason a slightly different name might be more appropriate. ...
    (alt.comp.lang.learn.c-cpp)