Float problems
Matthew Paul Rhoten
mrhoten at neon.Stanford.EDU
Sun May 26 09:49:43 AEST 1991
In article <1991May25.213301.13765 at cs.mcgill.ca>
storm at cs.mcgill.ca (Marc Wandschneider) writes:
>#include<stdio.h>
>float testfloat (void);
>[...]
> f = testfloat;
>[...]
The problem is that parentheses are needed in a call to a function with a
void argument list. When I try and compile the code above, I get "Illegal
pointer arithmetic" or some such - because when I give the compiler the
token "testfloat" it matches it with a pointer-type. I think the
interpretation of the error is implementation-dependent. To call the function,
simply include an empty set of parentheses after the function's name:
f = testfloat();
This will work quite nicely. At least it did on my compiler.
Hope this helps.
-matt
--
Matt Rhoten | PO Box 10031 | Standard disclaimers apply.
mrhoten at cs.stanford.edu | Stanford, CA 94309 | (415) 497-2853 | veni vidi vomui
More information about the Comp.lang.c
mailing list