[ create a new paste ] login | about

Link: http://codepad.org/BuTRF0Ra    [ raw code | output | fork ]

C++, pasted on Jan 8:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
#include <string>

std::string foo(const char* const s)
{
    std::string out(s);
    std::cout << "address: " << (void*)(&out) << std::endl;
    return out;
}

int main()
{
   std::string s = foo("abc");
   std::cout << "address: " << (void*)(&s) << std::endl;
}


Output:
1
2
address: 0xbf7eaa54
address: 0xbf7eaa88


Create a new paste based on this one


Comments: