I am having a mental block and I know I should know this but I need a little help.
If I declare a string variable like this:
string word = "Hello";
Write a function that takes one argument, the address of a string, and prints that string once. (Note: you will need to use a pointer to complete this part.)
However, if a second argument, type int, is provided and is nonzero, the function should print the string a number of times equal to the number of times that function has been called at that point. (Note that the number of times the string is printed is not equal to the value of the second argument; it is equal to the number of times the function has been called so far.)
std::string::data()if your data isn't null-terminated c-string like.
std::string::c_str()if you want the data and be guaranteed to get the null-termination.
Note that the pointer returned by either of these calls doesn't have to be the underlying data the
std::string object is manipulating.