[ create a new paste ] login | about

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

C++, pasted on Dec 7:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
using namespace std;

char * update(char * str);

int main(){
    const char * str = "test";
    char * ptr = (char *)str ;
    cout<<update(ptr)<<endl;
    return 0;
}

char * update(char * str){
    str[0] = 'A';
    return str;
}


Output:
1
Segmentation fault


Create a new paste based on this one


Comments: