• Switch and Case structure
    I am trying to do a simple function to return values based on the input...shown below. char func (unsigned char add) { signed char i; switch (add) { case 0: i = 0; break; case 1: i = 1; break;...
  • Trouble in "SWITCH" case
    Dear all iam having problem with SWITCH case switch(aaa) { case '1': LIGHT=1; printf("Light On\n"); break; case '2': LIGHT=0; printf("Light Off\n"); break; case '3': printf("Unknown...
  • Switch Case Statement problem
    I am using switch statement as follows uint16 val; switch (val) { case 0x0000: ... break case 0x0001: ... break case 0x0000: ... break case 0x0000: ... break case 0x0000: ... break...
  • Switch / Case Optimization
    I've read through this thread: http://www.keil.com/forum/8020/ and I understand that: 1. For "a few" case values, I'll get a series of if / else if's. Not sure how many that is. 2. If the case...
  • switch case fail
    void xx(char cc) { char aa; switch(cc) { case 1:case 0: aa=1; break; case 2,3: aa=2; break; } } //---------------------------------- xx(0); //run OK xx(1); //run OK xx(2); //run FAIL <<*...