English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

#include
#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(test)+result);
}
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
*/

2006-10-08 11:03:13 · 3 answers · asked by topgun553 1 in Computers & Internet Programming & Design

3 answers

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.

2006-10-08 11:09:39 · answer #1 · answered by James L 5 · 0 0

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

2006-10-08 18:07:43 · answer #2 · answered by Robin C 4 · 0 0

what the ?????????????

2006-10-08 18:10:35 · answer #3 · answered by Hollywood 2 · 0 0

fedest.com, questions and answers