i am designing a walking dinosaur any body please tell me how to move legs ?

If you want a low quality walking effect, you can pose several keyframes with the dinosaur in different stages of walking and play them in succession. For a more high quality effect, you may want to read up on skeletal animation.

Because you took the time to post your code and because your code actually compiles and runs, I took some time to look at it. Originally, I thought you were talking about a 3D model of a dinosaur which would require animating all 4 legs. Your situation is much simpler. It's 2D and there's really only one leg. Also you are not worried about the interface between the leg and the body. A few comments on your code. You've gotten an animation effect by putting 'glutPostRedisplay' in your DisplayFunc (legs). This is not the recommended way to do animation, though I've seen it done before. The conventional approach is to use an Idle function. It is called continuously after each display until you set the idle behaviour back to the default using glutIdleFunc(NULL). glutPostRedisplay goes in the 'Walk', not in the display function. In my code below you see the function 'Walk' declared as the IdleFunc. The 'Walk' function simply changes the value of 'angle' which is used to rotate the leg at the hip. Remember the modeling transformations are applied to geometry in the reverse order of how they appear in the code. Look at my legs routine to see this. The code below is reworking of your code (without deviating too much from what you posted). Next time you post code put it between [ code] and [ /code] tags.