#include <stdio.h>
#include <stdlib.h>
struct Node {
    int data;
    struct Node* prev;
    struct Node* next;
};
struct Node* pRoot = NULL;
void Inorder(struct Node* root) {
    if (root->prev != NULL) {
        Inorder(root->prev);
    }
    printf("%d ", root->data);
    if (root->next != NULL) {
        Inorder(root->next);
    }
}
void Assort(struct Node* cur, struct Node* pstan) {
    if (pRoot == NULL) {
        pRoot = pstan = cur;
    }
    else if (cur->data < pstan->data) {
        if (pstan->prev == NULL) {
            pstan->prev = cur;  
        }
        else if (pstan->prev != NULL) {
            Assort(cur, pstan->prev);
            printf("작동함\n");
        }
    }
    else if (cur->data >= pstan->data) {
        if (pstan->next == NULL) {
            pstan->next = cur;
        }
        else if (pstan->prev != NULL) {
            Assort(cur, pstan->next);
            printf("작동함\n");
        }
    }
}
int main() {
    struct Node* pStan = NULL;
    struct Node* Current;
    for (int i = 0; i < 5; i++) {
        struct Node* Current = (struct Node*)malloc(sizeof(struct Node));
        printf("정수를 입력하세요.\n");
        scanf("%d", &Current->data);
        Assort(Current, pStan);
        pStan = pRoot;
    }
    Inorder(pRoot);
    return 0;
}
else if (cur-\>data \< pstan-\>data) {
In this paragraph an unhandled exception was thrown: read access violation.
pstan was 0xCDCDCDCD.
This error occurs.
I expect this to be a problem related to pointers, but since I don't know much about data structures and pointers yet, I don't know where the exception is not handled, so I'm asking a question. This code is made for the purpose of a bidirectional linked list. However, I think that part of this is something I need to think about. I just want to know why I am getting an error regarding pointers.
 
     
    