C++ Reverse Array

后端 未结 4 752
北恋
北恋 2020-12-01 20:22

In C++, I need to:

  • Read in a string from user input and place it into a char array [done]
  • Then pass that array to a function [done]
  • The funct
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 20:45

    Since this is homework, I'll point you toward a solution without just giving you the answer.

    Your reverse function can modify the word that is passed in. One thing you'll need to know is how long the word is (so you'll know how many letters to reverse), you can get this from the strlen() function. If you're not permitted to use pointers, then you can use a local int index variable.

提交回复
热议问题