Hello there! I encountered this problem during a technical interview.
In the question, a string array has the following elements: {"polymorphism", "inheritance", "classes"}
then using a pointer and some manipulations, the program was able to output "cancers".
wherein the letter "c" was extracted from "classes",
the letter "s" was from "polymorphism"
and the "ance" was from the last 4 letters of "inheritance".
I'm trying to retype the program again so I could understand the problem, but I forgot the program already.
oh yeah i forgot r. the "r" is also from "polymorphism"
I forgot how the program went already and I'm trying to retype it but i couldn't because i don't get how the question was able to output only one character from a string. like for example the character "c" from "classes". And only using a pointer. This is what I got so far:
strlen() cannot be used because it expects a const char* as argument, not an std::string nor an array of those. I don't see how it would be useful anyway.
For example header string.h is a header that contains declarations of standard C functions. It does not contain the definition of class std::basic_string according to the C++ standard.