[ create a new paste ] login | about

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

C, pasted on Apr 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void func(char **str)
{
    *str = realloc(*str, 10);
    *str[0] = '\0'; // I get segfault here.
    //strncat(*str, -, -);

    // memcpy(*str, -, -);
    // *str[strlen(str)] = '\0'; // I get segfault here.
}

int main(void)
{
    char *str = NULL;
    func(&str);
    return 0;
}


Output:
No errors or program output.


Create a new paste based on this one


Comments: