[Solved] Arithmetic expression before the equal sign


Your so called equal sign (=) is actually assignment operator in programming world. Equal sign is double equal == which may use in logical opeartion.

ctr =+ 1; // means, assign positive 1 into ctr, Compile fine
ctr =- 1; // means, assign negative 1 into ctr, Compile fine
ctr =* 1; //Compilation error like this: illegal start of expression
ctr =/ 1; //Compilation error like this: illegal start of expression

For the followings,

ctr += 1; // means, ctr = ctr +1, Compile fine
ctr -=1;  // means, ctr = ctr -1, Compile fine
ctr /= 1; // means, ctr = ctr /1, Compile fine
ctr *= 1; // means, ctr = ctr *1, Compile fine

You may get garbage unless you initialize ctr first.

solved Arithmetic expression before the equal sign