Re: what's wrong with it?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Zhiyong Xu writes:
 
 > 
 > here's the description:
 > 1. I have a function evaluate defined in t.c
 > 2. in ex.c, I call function evaluate without prototype
 > defined. 
 > using gcc -lm ex.c t.c, I can generate the executable
 > file a.out,
 > when executing, the result is wrong
 > 3. if I modify ex.c, add the prototype definition, the
 > result is correct.
 > 
 > Anything wrong with the first case?

Yes:

int main(void)
{
        evaluate(sin, 2.0,3.0,4.0);
        evaluate(sqrt,2.0,3.0,4.0);

        return(0);
}

But working without ptototypes is stupid and pointless.  Don't do it.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux