[ create a new paste ] login | about

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

C++, pasted on Jul 5:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main()
{
    //stack allocation syntax 1
    string s = string("Sayounara");
    cout << s << endl;
    
    //stack allocation syntax 2
    string t("Goodbye");
    cout << t << endl;

    //heap allocation
    string *u = new string("Au revoir");
    cout << *u << endl;

    //stack allocation syntax 3
    string v;
    v.assign("Arrivederci");
    cout << v << endl;
    
    return 0;
}


Output:
1
2
3
4
Sayounara
Goodbye
Au revoir
Arrivederci


Create a new paste based on this one


Comments: