[ create a new paste ] login | about

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

C++, pasted on Apr 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <iostream>
using namespace std;
 
int main()
{
    char * str = "qwerty";
    char * ptr = str;//Запомнили начальный адрес строки
    cout<<"str : "<<str<<"\t(adr : "<<&str<<")"<<endl;
    cout<<"ptr : "<<ptr<<"\t(adr : "<<&ptr<<")"<<endl;
    str += 2;
    cout<<"str : "<<str<<"\t(adr : "<<&str<<")"<<endl;
    cout<<"ptr : "<<ptr<<"\t(adr : "<<&ptr<<")"<<endl;
    system("pause");
    return 0;
}


Output:
1
2
3
cc1plus: warnings being treated as errors
In function 'int main()':
Line 6: warning: deprecated conversion from string constant to 'char*''


Create a new paste based on this one


Comments: