c program for threaded binary tree

#include <stdio.h>
#include <stdlib.h>

struct Node {
    int key;
    struct Node left, right;
};

struct Node* newNode(int key) {
    struct Node temp = (struct Node)malloc(sizeof(struct Node));
    temp->key = key;
    temp->left = temp->right = NULL;
    return temp;
}

void insert(struct Node* root, int key) {
    if (!root) {
        root = newNode(key);
        return;
    }

    struct Node* current = root;
    struct Node* parent = NULL;

    while (current) {
        parent = current;
        if (key < current->key)
            current = current->left;
        else
            current = current->right;
    }

    if (key < parent->key)
        parent->left = newNode(key);
    else
        parent->right = newNode(key);
}

void inorder(struct Node* root) {
    if (root) {
        inorder(root->left);
        printf("%d ", root->key);
        inorder(root->right);
    }
}

int main() {
    struct Node* root = NULL;

    insert(root, 50);
    insert(root, 30);
    insert(root, 20);
    insert(root, 40);
    insert(root, 70);
    insert(root, 60);
    insert(root, 80);

    printf("Inorder traversal of the threaded binary tree: ");
    inorder(root);

    return 0;
}