c++ - How do I find the memory address of a string? -
c++ - How do I find the memory address of a string? -
i having mental block , know should know need little help.
if declare string variable this:
string word = "hello";
how find memory address of "hello"?
edit: trying do...
write function takes 1 argument, address of string, , prints string once. (note: need utilize pointer finish part.)
however, if sec argument, type int, provided , nonzero, function should print string number of times equal number of times function has been called @ point. (note number of times string printed not equal value of sec argument; equal number of times function has been called far.)
use either:
std::string::data()
if info isn't null-terminated c-string like. or
std::string::c_str()
if want info , guaranteed null-termination. note pointer returned either of these calls doesn't have underlying info std::string
object manipulating.
c++ string memory-address
Comments
Post a Comment