decomposition declaration cannot be declared with int

Hi I am coding a project for a robot to autonomously go from wall to wall in a box and came across this error, I was not sure how to fix this so I am asking the community. Sorry I'm new to coding please be nice

Presumably you are trying to declare an array of int, the brackets go with the array name, not the type.

Posting pictures of code is the least desirable way. Read the forum guidelines to see how to properly post code and error messages.

Presumably you are trying to declare an array of int, the brackets go with the array name, not the type.

Can someone explain to me why line 25 is OK and line 26 is not? I'm mystified.

1 Like

Sometimes it takes a a while to spot syntactic errors.

johnerrington:
Can someone explain to me why line 25 is OK and line 26 is not? I'm mystified.

Fix line 26 and after recompile the error will more than likely move to line 25.

Thanks, yes I finally spotted it.

All of the methods below are valid ways to create (declare) an array.

int myInts[6];
int myPins[] = {2, 4, 8, 3, 6};
int mySensVals[6] = {2, 4, -8, 3, 2};

and NOT

int [] duration...