Monday, May 24, 2010

Quick C++ Question--WHATS WRONG???

#include %26lt;iostream%26gt;


#include "recursive.h"


#include "p2.h"





using namespace std;








static int sum_helper(list_t test, int result)


{


return (sum_helper(list_rest(test)),list_first(...


}


int sum(list_t test)


{


returnsum_helper(test,0);


}





/*


Get Errors


p2.cpp: In function `int sum_helper(void*, int)':


p2.cpp:9: error: too few arguments to function `int sum_helper(void*, int)'


p2.cpp:10: error: at this point in file


*/

Quick C++ Question--WHATS WRONG???
On this line:





return (sum_helper(list_rest(test))





That last parenthesis is wrong.





sum_helper wants two arguments, but you're closing the argument list with that last parenthesis.
Reply:what the ?????????????
Reply:Erhm.


Can you please include p2.h and recursive.h





The file alone does not have a starting point (int main()).


And are you using the function sum_helper to return itself... that just doesn't make sense

wedding song

No comments:

Post a Comment