title: Go to a line number in embedded C outside of the function
body: <p>Is it possible to call a line number in embedded C that is outside of the function? </p>
  
  <p>Simple goto label commands can't work because I am in the if statement loop: I want to restart the function once the error is greater than 200. </p>
  
  <pre><code>void followWall(void)
  {
  
  begin:
  
      int desired = getADC();                                                      //store the first ADC reading as the desired distance from the wall
      int right = 200;                                                             //pre set all variables to be called in the drive function
      int left = 200;                                                              //ints are needed here for bit masking later on to stop overflow
      char rightH = 0;
      char leftH = 0;
      float k = 0.5;                                                               //constant to times the error to fine tune the response
      drive(rightH,right,leftH,left);                                              //drive the robot to the pre set variables
  
      while( bumpFlag == 0 )                                                       //while the robot has not been bumped or encounted a cliff
      {
          int actual = getADC();                                                   //call a new ADC reading everytime at start of while as the current reading
          rightH = 0;
          leftH = 0;                                                               //set variables back to default to stop constant increase and decrease in variables
          left = 200;
          right = 200;
          char error = abs(actual-desired);                                        //calculate the error by minusing the actual distance to the desired
  
          if(motorAngle &lt; 180)                                                     //wall on left between 1st and 2nd quadrant
          {
              if(error &gt; 200)
              {
                  stop();
                  moveStepper(33,0);
                  goto begin;
              }
              if (actual &gt; desired)                                                
              {
                   right -=((error)*k);                                            
                   left += ((error)*k);                                            
              }
              else if (actual &lt; desired)                                           
              {
                   left -=((error)*k);                                             
                   right +=((error)*k);                                            
              }
          }
          else if (motorAngle &gt; 180)                                               
          {
              if(error &gt; 200)
              {
                  stop();
                  moveStepper(33,1);
                  goto begin;
              }
              if (actual &gt; desired)                                                
              {
                   left -=((error)*k);                                             
                   right +=((error)*k);                                            
              }
              else if (actual &lt; desired)                                           
              {
                   right -=((error)*k);                                            
                   left +=((error)*k);                                             
              }
  
          }
       drive(rightH,right,leftH,left);                                                       bumpSensor();                                                               
       setLCDCursor(0x09);
       writeLCDNumber(convert(actual));                                            //constantly write the converted AC value on the LCD
      }
      stop();                                                                      //stop the robot
  }
  </code></pre>