Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

invalid binary operands error in this code can any one help me please

 
Rizwan Lateef
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
-(float *) angleInRadians{
int *n = numberOfSides;
float *result = ((n - 2) * 180);
result /= numberOfSides;
float *angle = (result * (M_PI / 180));
return angle;
}
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int and float are not pointer object types, you should remove the "*"

int n = numberOfSides;
float result = ((n - 2) * 180);

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To do it all for you

-(float) angleInRadians{
int n = numberOfSides;
float result = ((n - 2) * 180);
result /= numberOfSides;
float angle = (result * (M_PI / 180));
return angle;
}

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic