that only displays the movement of turtle by special character i.e *
and allows user to:
move up
move down
move left
move right
and some other basic moves.
How can I make a turtle graphic program in c?
- Posted:
- 3+ months ago by saadabbasi
- Topics:
- display, movement, program, turtle, left, special, down, right, character, graphic, user, turtles
Details:
Answers (2)
Several problems although the initial error is that your second while loop starts with i already set to the end of the array (since the previous loop exits when it reads a 9)
You also dont have any bounds checking, i.e. what happens if I enter 21 codes?
You should replace all the constants (i.e. commands and directions) with an enumerations, makes the code much easier to read
Use functions to remove duplicated code.
You can simplify the direction handling.