The following C code returns a \"segmentation fault\" error. I do not understand why it does not return the value 20. What is my error?
#include
You haven't allocated memory to n, so
n
*n = 20;
attempts to write unspecified memory.
Try
#include int *n = malloc(sizeof *n); /* use n */ free(n);