Output is Segmentation fault (core dumped). The line of error is line 12 but I do not understand why that would be an issue. If ret is assigned a memory location and equal to something, why is a segmentation fault outputted?
Code is:
#include <stdio.h>
#include <string.h>
int main() {
const char *tmp = "This string literal is arbitrary";
char *ret;
ret = strstr(tmp, "literal");
strcpy(ret, "");
if (ret)
printf("found substring at address %p\n", ret);
else
printf("no substring found\n");
return 0;
}