How to print an entered string backwards in C using only a for loop

前端 未结 6 1093
日久生厌
日久生厌 2021-01-16 12:15

I want to print a string backwards. But my code seems to count down the alphabet from the last letter in the array to the first letter in the array instead of counting down

6条回答
  •  孤独总比滥情好
    2021-01-16 13:16

    In your loop, x is the index into the character array comprising word. So x should change from end to 0, and referencing the array should be as word[x].

提交回复
热议问题