expected primary-expression problem

I have read many post on why you would get this error, and it usually is because of syntax errors. Especially when getting the {} mixed up with ().

I have thoroughly checked out my code with BIG font size so it would be really easy to see where the fault was at. No luck finding the error, so with the following snipped code:

////////////////////////////////////////
int readButton(int, int);

int main(){
readButton(39, 1);
return 0;
}

// Read pin
int readButton(int GPIOPin, int short)
{
////////////////////////////////

I get the errors of:
In function 'int readButton(int, short int)':
error: expected primary-expression before 'short'
error: expected ')' before 'short'
Last edited on
In your code you are not naming an int called short, you are instead creating a short integer with no name. This contradicts your original definition that states it shall take two integer arguments.
Thanks firedraco for the quick reply.

I changed the int 'short' to shorted' so the compiler would not get confused by my naming convention.

And have tried other ways to declare it but with no success. Could you please post how the code should be entered?

Last edited on
Did changing the name from 'short' to something else not work? What was the problem with that method that you tried?
Opps, I compiled the wrong code to test the 'short' to 'shorted' out with. It compiles nicely now. Thank you for your support. It is greatly appreciated.
Topic archived. No new replies allowed.