Stack create(int c)
{
    Stack S=(Stack)malloc(sizeof(struct stack));
    S->size=c;
    S->top=-1;
    S->array=(char *)malloc(sizeof(char)*c);
    return S;
}
Stack makeEmpty(void)
{
    Stack *S1=create(100);
    S1[0]->top=-1;
    return S1;
}
char pop(Stack S)
{
    return S->array[S->top--];
};
int main(void)
{
    Stack *S1;
    S1=makeEmpty();
    int j;
    int k=0;
    char result[30];
    for(j=0; j<2; j++)
    {
        char result1=pop(S1);
        strcat(result, result1);
        k++;
    }
}
I skipped some parts, like typedef struct stack Stack;
What I wanted to do was pop out elements from the stack while for-loop works. Then, store those elements in a new array which is result. To check whether it works or not, I printed out but I had a runtime error. How to store the element and how to print it out?
 
     
    