Language: C

#include<stdio.h>
#define NUL -1
const int N_MAX = 45;
int root;
struct Node{
    int parent, left, right;
};
Node tree[N_MAX];
int pre[N_MAX], in[N_MAX];

void reConstruct(int parent, int * preP, int * inP, int n, bool isLeft){
    if(n==0) return;
    int nowRoot = preP[0];
    tree[nowRoot].parent = parent;
    //getchar();
    //cout<<"-- nowRoot: "<<nowRoot<<endl;
    if(parent==NUL){
        root=nowRoot;
    }else if(isLeft){
        tree[parent].left=nowRoot;
    }else{
        tree[parent].right=nowRoot;
    }
    if(n==1)return;
    int flag = 0;
    for(;flag<n;flag++){
        if(inP[flag]==nowRoot) break;
    }
    //cout<<"nowRoot: "<<nowRoot<<" flag: "<<flag<<endl;
    reConstruct(nowRoot, preP+1, inP, flag, true);
    reConstruct(nowRoot, preP+1+flag, inP+1+flag, n-flag-1, false);
}

void post(int id){
    if(id==NUL) return;
    if(tree[id].left==NUL&&tree[id].right==NUL&&id!=root){
        printf("%d ", id);
        //cout<<id<<" ";
        return;
    }
    post(tree[id].left);
    post(tree[id].right);
    if(id==root){
        printf("%d", id);
        //cout<<id<<endl;
    }else{
        printf("%d ", id);
        //cout<<id<<" ";
    }
}

int main(){
    int n;
    scanf("%d", &n);
    //cin>>n;
    for(int i=0;i<n;i++){
        scanf("%d", &pre[i]);
        //cin>>pre[i];
        tree[i].parent=tree[i].left=tree[i].right=NUL;
    }
    tree[n].parent=tree[n].left=tree[n].right=NUL;
    for(int i=0;i<n;i++){
        scanf("%d", &in[i]);
        //cin>>in[i];
    }
    reConstruct(NUL, pre, in, n, true);
    /*//Debugging/
    for(int i=1;i<=n;i++){
        cout<<"node"<<i<<": p: "<<tree[i].parent<<"  l: "<<tree[i].left<<"  r: "<<tree[i].right<<endl;
    }
    ///Debugging*/
    post(root);
    //cout<<"root: "<<root<<endl;
    return 0;
}



Compiler output:
main.c:8:1: error: unknown type name 'Node'; use 'struct' keyword to refer to the type
    8 | Node tree[N_MAX];
      | ^~~~
      | struct 
main.c:8:6: error: variably modified 'tree' at file scope
    8 | Node tree[N_MAX];
      |      ^~~~
main.c:9:5: error: variably modified 'pre' at file scope
    9 | int pre[N_MAX], in[N_MAX];
      |     ^~~
main.c:9:17: error: variably modified 'in' at file scope
    9 | int pre[N_MAX], in[N_MAX];
      |                 ^~
main.c:11:60: error: unknown type name 'bool'
   11 | void reConstruct(int parent, int * preP, int * inP, int n, bool isLeft){
      |                                                            ^~~~
main.c:2:1: note: 'bool' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdbool.h>
    2 | #define NUL -1
main.c: In function 'post':
main.c:36:16: error: request for member 'left' in something not a structure or union
   36 |     if(tree[id].left==NUL&&tree[id].right==NUL&&id!=root){
      |                ^
main.c:36:36: error: request for member 'right' in something not a structure or union
   36 |     if(tree[id].left==NUL&&tree[id].right==NUL&&id!=root){
      |                                    ^
main.c:41:18: error: request for member 'left' in something not a structure or union
   41 |     post(tree[id].left);
      |                  ^
main.c:42:18: error: request for member 'right' in something not a structure or union
   42 |     post(tree[id].right);
      |                  ^
main.c: In function 'main':
main.c:59:16: error: request for member 'parent' in something not a structure or union
   59 |         tree[i].parent=tree[i].left=tree[i].right=NUL;
      |                ^
main.c:59:31: error: request for member 'left' in something not a structure or union
   59 |         tree[i].parent=tree[i].left=tree[i].right=NUL;
      |                               ^
main.c:59:44: error: request for member 'right' in something not a structure or union
   59 |         tree[i].parent=tree[i].left=tree[i].right=NUL;
      |                                            ^
main.c:61:12: error: request for member 'parent' in something not a structure or union
   61 |     tree[n].parent=tree[n].left=tree[n].right=NUL;
      |            ^
main.c:61:27: error: request for member 'left' in something not a structure or union
   61 |     tree[n].parent=tree[n].left=tree[n].right=NUL;
      |                           ^
main.c:61:40: error: request for member 'right' in something not a structure or union
   61 |     tree[n].parent=tree[n].left=tree[n].right=NUL;
      |                                        ^
main.c:66:5: error: implicit declaration of function 'reConstruct' [-Wimplicit-function-declaration]
   66 |     reConstruct(NUL, pre, in, n, true);
      |     ^~~~~~~~~~~
main.c:66:34: error: 'true' undeclared (first use in this function)
   66 |     reConstruct(NUL, pre, in, n, true);
      |                                  ^~~~
main.c:66:34: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
main.c:66:34: note: each undeclared identifier is reported only once for each function it appears in