General question about helper functions

So I have to implement a couple helper functions in my program. First off, what exactly is a helper function and how do I define it?

Do I have to put a helper function as a prototype function and also define it?

I tried finding helper function examples but my search was unsuccessful. Any help would be appreciated.
A helper function is usually a simple function that does a particular task, not necessarily tied to a particular class. Let's say, for example, that you have a list of items, cataloged by some ID, from 1 to 2000, and that you want to process a subset of this. The user should input which items to process. To simplify user input, if you have consecutive elements, you should allow to write first ID, a dash, then the last ID. Then an input "1-5,7, 11-15" should be translated into "1,2,3,4,5,7,11,12,13,14,15". You can write a member function of the class that processes the object to process the input string. But if you write another program that uses the same type of input, you would need to implemented again. The other option would be to create a "helper function" std::string processComplexInputString(std::string) that you can import into your cpp file.

In rest, your helper function is like any other C/C++ function
Topic archived. No new replies allowed.