title: C — warning: control reaches end of non-void function [-Wreturn-type]
body: <p>I am a newbie in C programming.
  Can anyone help me to explain about the error that I'm getting.
  I don't understand why I'm getting this error.</p>
  
  <pre><code>test4.c: In function 'main':
  test4.c:65:3: warning: control reaches end of non-void function [-Wreturn-type]
  </code></pre>
  
  <p>Below is my code :</p>
  
  <pre><code>#include &lt;webots/robot.h&gt;
  #include &lt;webots/distance_sensor.h&gt;
  #include &lt;webots/differential_wheels.h&gt;
  
  #define TIME_STEP 64
  
  int main()
  {
     wb_robot_init();
     int i;
     WbDeviceTag ps[8];
     char ps_names[8][4] = {"ps0","ps1","ps2","ps3",
        "ps4","ps5","ps6","ps7"};
  
     for(i=0;i&lt;8;i++)
     {
        ps[i]=wb_robot_get_device(ps_names[i]);
        wb_distance_sensor_enable(ps[i], TIME_STEP);
     }
  
     while(1)
     {
        int delay=wb_robot_step(TIME_STEP);
        if(delay==-1)
           break;
  
        double ps_values[8];
        for(i=0;i&lt;8;i++)
           ps_values[i]=wb_distance_sensor_get_value(ps[i]);
        //printf("ps0=%d\t", ps_values[0]); 
  
        double left_speed=500;
        double right_speed=500;
  
        for(;;)
        {
  
           if(ps_values[0]&gt;80 || ps_values[1]&gt;80 || ps_values[2]&gt;80)
           {
              left_speed =-500;
              right_speed =500;
           }
           else if(ps_values[5]&gt;80 || ps_values[7]&gt;80 || ps_values[2]&gt;80)
           {
              left_speed =500;
              right_speed =-500;
           }
           else
           {
              left_speed =500;
              right_speed =500;
           }
  
        }
        wb_differential_wheels_set_speed(left_speed, right_speed);
        wb_robot_cleanup();
        return 0;
     }
  }
  </code></pre>