Segfault from adding a variable
I'm admittedly a straight-C newbie, but this has got me stumped. I'm working on a linked list implementation for practice, and I'm getting a segfault by simply adding a variable to the split_node function: #include <stdio.h> #include <string.h> #include <stdlib.h> struct Node { struct Node *child; char *content; }; void print_list(struct Node node); void split_node(struct Node *node, int position); int main() { struct Node head, second, third; head.content = "first"; second.content = "second"; third.content = "i'm third"; head.child = &second; second.child = &third; print_list(head); split