How to convert a string to an int without pointers.

My teacher has done a very poor job of teaching us anything this year. When he taught us for loops, he wrote one on the board, didn't explain any of it, then said now that you know for loops we can implement them in a code. but anyway, we need to write a code for converting a string to an int and all the examples i find on the internet use pointers but we aren't allowed to use those yet. I don't have any idea for how to start so any help will be appreciated.
Last edited on
They all use pointers because that is what the function "std::stoi()" uses as one of it's parameters. I would use "std::stoi()" and pass NULL in as the second argument and tell him that you didn't use a pointer.
i need to write the actual code for the function. i understand that there's an stoi function but we need to write the source code for it from scratch.
Topic archived. No new replies allowed.