#include <stdio.h>
#include <stdlib.h>
#pragma warning (disable: 4996)
typedef struct treeNode *tree_pointer;
typedef struct treeNode {
char key;
tree_pointer left_child;
tree_pointer right_sibling;
}treeNode;
tree_pointer createNode(char key) {
tree_pointer newNode = (tree_pointer)malloc(sizeof(treeNode));
newNode->left_child = NULL;
newNode->right_sibling = NULL;
newNode->key = key;
return newNode;
}
int main(void) {
char data[50] = { 0 };
int i = 0;
tree_pointer node[52];
scanf("%s", data);
while (data[i] != 0) {
if (i == 0)
node[i] = createNode(data[i]);
if (data[i] == '(') {
node[i]->left_child = createNode(data[i+1]);
}
i++;
}
return 0;
}
A(B(D(I),E,F)를 입력했을때,
빨간 부분에서 오류가 나네요
혹시 어떻게 고쳐야하는지 여쭤봐도 될까요????