You get a pointer. It can be invalid. It can point to location of local variable. It can point to a member of an array. It can point to dynamically allocated memory block large enough for one or multiple variables.
Your function call creates a copy of a pointer. It cannot adjust the pointer that the caller has.
" Hello Wordl!" is a string constant. Non-const pointer to it is hardly appropriate.
can you use std::deque or std::list or are stl containers not allowed?
I can't use those either.
keskiverto wrote:
You get a pointer. It can be invalid. It can point to location of local variable. It can point to a member of an array. It can point to dynamically allocated memory block large enough for one or multiple variables.
Your function call creates a copy of a pointer. It cannot adjust the pointer that the caller has.
" Hello Wordl!" is a string constant. Non-const pointer to it is hardly appropriate.
It was just an example. The char** variable will not hold constants. It will hold words from a file. [EDIT] I'm not sure I understood what you were trying to say. [/EDIT]