October 6th, 2003, 05:34 PM
Problems with function
error C2556: 'void __cdecl null(float,float,float)' : overloaded function differs only by return type from 'float __cdecl null(float,float,float)'
7) : see declaration of 'null'
(23) : error C2371: 'null' : redefinition; different basic types
*edit: placed code tags
using namespace std;
float null( float a, float b, float c);
null(h, b, product);
void null( float a, float b, float c)
*note: start using code tags around your code samples
Last edited by Onslaught; October 6th, 2003 at 09:25 PM.
October 6th, 2003, 06:03 PM
you cant call your function null.
.no, you implement it different then u declared it. it returns a float.
October 6th, 2003, 07:22 PM
hmmm...can you specify where?
October 6th, 2003, 07:33 PM
Compare the function prototype at the top of the file with the function header where you actually define the function. They need to be identical (except for the semicolon, of course). Because the second one is different from the first, the compiler is complaining that it has been redefined.
Now, if you still want to return the value through the third argument (float c), then you need to make it a reference. Otherwise you will never get the answer from that function. And be sure to put that change in both the function prototype AND the function header (you've got to keep them identical).