Can you have a structure in C that has elements of that same structure? My first attempt at implementing a binary search tree in C is the following:
#include <stdio.h>
struct binary_tree_node {
int value;
struct binary_tree_node *left = null;
struct binary_tree_node *right = null;
};
main() {
struct binary_tree_node t;
t.value = 12;
struct binary_tree_node y;
y.value = 44;
t.left = &y;
}
I can't figure out what's wrong with this code, any help would be appreciated. I realize there are other questions on binary search implementations in C, but I'm trying to figure this out from scratch with my own code (and some guidance of course). Thanks!