title: Comparison between signed and unsigned integer expressions
body: <p>I just started using OpenGL. This is my first code:</p>
  
  <pre><code>// OpenGL hello program
  #include&lt;iostream&gt;
  #include &lt;GL/glut.h&gt;
  #include &lt;cstring&gt;
  
  void display() {
      glClear(GL_COLOR_BUFFER_BIT);
      char message[] = "Hello, world!";
      glRasterPos2d(0, 0);
      for (int i = 0; i &lt; sizeof(message) / sizeof(message[0]); i++)
      {
          glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, message[i]);
      }
  }
  
  int main(int argc, char *argv[]) {
      glutInit(&amp;argc, argv);
      glutInitWindowSize(500, 500);
      glutCreateWindow("OpenGL hello program");
      glutDisplayFunc(display);
      glutMainLoop();
  }
  </code></pre>
  
  <p>The error I am getting is: <em>Warning: comparison between signed and unsigned integer expressions (line 9).</em>
  I also tried writing a new code then to see whats causing the problem:</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include &lt;cstring&gt;
  
  void display1() {
      char message[] = "Hello, world!";
  
      for (int i = 0; i &lt; sizeof(message) / sizeof(message[0]); i++)
          std::cout&lt;&lt;message[i];
  }
  
  int main() {
      display1();
  }
  </code></pre>
  
  <p>This code works perfectly fine. Why is the first code not working fine?</p>
  
  <p><strong>EDIT:</strong>
  Following up on Cyber's annswer, I changed the loop to:</p>
  
  <pre><code>for (unsigned int i = 0; i &lt; sizeof(message) / sizeof(message[0]); i++)
  </code></pre>
  
  <p>But the <em>OpenGL</em> code does not do the expected i.e. show "Hello, world!" message in the window. It just creates a window with "OpenGL hello program" written at the top and nothing else.</p>