xxxxxxxxxx
char *str;
str = “Holberton”;
xxxxxxxxxx
julien@ubuntu:~/c/malloc$ cat segf.c
/**
* segf - Let's segfault \o/
*
* Return: nothing.
*/
void segf(void)
{
char *str;
str = "Holberton";
str[0] = 's';
}
/**
* main - concept introduction
*
* Return: 0.
*/
int main(void)
{
segf();
return (0);
}
julien@ubuntu:~/c/malloc$ gcc segf.c
julien@ubuntu:~/c/malloc$ ./a.out
Segmentation fault (core dumped)
julien@ubuntu:~/c/malloc$