The error message tells it all. The case needs to be a constant...Like
1,2,3,4,5...or
#define one 1
const unsigned long two 2;
switch(angle)
{
case:1
{}
case:two
{}
}
gerard4143
Nearly a Posting Maven
2,295 posts since Jan 2008
Reputation Points: 512
Solved Threads: 397
Skill Endorsements: 0
But,the problem is that i can't go on writing all 360 cases for 360 values of an angle.
what I'm seeking is a solution for shortening the program length by somehow testing the condition in the case...
Is there any way of doing that??
that's where if else conditions shines, is it really required to use only a switch statement?
zeroliken
Nearly a Posting Virtuoso
1,346 posts since Nov 2011
Reputation Points: 214
Solved Threads: 205
Skill Endorsements: 14
Question Answered as of 1 Year Ago by
death_oclock,
gerard4143,
karthi.k.s
and 1 other