see the back of glut solid cube

when creating a bunch of cubes right next to each other i have noticed that you can see the backs of the cubes meaning they are ‘hollow like’… how do i make this not happen?

You probably forgot to enable depth testing.

  glEnable(GL_DEPTH_TEST);