Too many parameters error

Hello,

I am trying to compile my code but I found the next error: too many parameters error.
I created a function called spwrite -> void spwrite(uint8_t x,uint8_t v);
Then I used the function in main()

spwrite(Xdata, Ydata);

Xdata and Ydata are declared well. Why should I do to solve the error?
Thanks
closed account (S6k9GNh0)
1
2
3
4
int main(int argc, char ** argv)
{
  //the error means you put to many parameters in the function.
}
What does it mean? Should I write the main function in that way despite that main function has no parameters?

Thanks
closed account (S6k9GNh0)
No, it means you called to many parameters in your function

Let's call:int hiMeBob(int uno, int dos)

hiMeBob(1, 2, 3); // This would produce the error. The three is an extra parameter and it's like Dubya Tee Eff.
Last edited on
1
2
3
void spwrite(uint8_t x,uint8_t v);

spwrite(Xdata, Ydata);


the reason you get the to many parameters error is uint8_t x & uint8_t v are not valid variables. i think you meant this

void spwrite(int 8_tx,int 8_tv); or this
void spwrite(int x, int y);

Remember to check your variable names & how many parmeters you have and pass in each call to your functions. it is an easy mistake to make. good luck.
Last edited on
The error is still there. I wrote the function with "int" parameters and the correct number of parameters but It didn't work.

Any other solution for this problem?
what is the error meesage? right now the only thing i can think of that your fucntion has not been defined in your code. you should have the following


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <something>
 void spwrite(int Xdata,int Ydata);

int main()
{

 int Xdata,Ydata;
do somethings
spwrite(Xdata,Ydata);
}

void spwrite(int x, int y)
{
do things
return;
}


hope this helps. if you can post your code along with error message
Topic archived. No new replies allowed.