Code :

```
#include<stdio.h>
#include<malloc.h>

typedef struct tree
{
    char data;
    struct tree *left;
    struct tree *right;
}*pos;

pos stack[30];
int top=-1;

pos newnode(char b)
{ 
    pos temp;
    temp=(struct tree*)malloc(sizeof(struct tree));
    temp->data=b;
    temp->left=NULL;
    temp->right=NULL;
    return(temp);
}

void push(pos temp)
{
    stack[++top]=temp;
}

pos pop()
{
    pos p;
    p=stack[top--];
    return(p);
}

void inorder(pos t)
{
    if(t!=NULL)
    {
        inorder(t->left);
        printf("%s",t->data);
        inorder(t->right);
    }
}
void preorder(pos t)
{
    if(t!=NULL)
    {
        printf("%s",t->data);
        preorder(t->left);
        inorder(t->right);
    }
}

void postorder(pos t)
{
    if(t!=NULL)
    { 
        postorder(t->left);
        postorder(t->right);
        printf("%s",t->data);
    }
}

void main()
{
    char *a;
    pos temp,t;
    int j,i;
    puts("Enter the expression :");
    scanf("%s",&a);
    for(i=0;a[i]!='\0';i++)
    {
        if(a[i]=='*' || a[i]=='/' || a[i]=='+' || a[i]=='-')
        {
            temp=newnode(a[i]);
            temp->right=pop();
            temp->left=pop();
            push(temp);
        }
        else
        {
            temp=newnode(a[i]);
            push(temp);
        }
    }
    inorder(temp);
    printf("\n");
    preorder(temp);
    printf("\n");
    postorder(temp);
}

```

Error : Segmentation Fault

This code is for construction of binary tree traversal and conversion of postfix to infix and prefix. I dont know where am going wrong but it keeps saying the same fault.
Can anyone help me with this ?