It seems you simply defined a pointer of type struct Stack but not allocated the stack itself
stack *s;
Thus s is equal to NULL. At least you should allocate the stack itself. For example
stack *s;
//...
s = malloc( sizeof( struct Stack ) );
But in any case there is no any need to define a pointer. You could define the stack itself. For example
stack s;
Aldo you need to set an initial value of data member top. I think you could initialize it with -1.
Also function insert itself is invalid.
void push(int x)
{
s->top++;
if(s->top<=19){
s->elements[s->top]=x;}
else
puts("Overflow");
}
Each time the function is called it increases data member top even if it points already beyond the array. The valid function could look like
void push(int x)
{
if ( s->top + 1 < 20)
{
s->elements[++s->top] = x;
}
else
[
puts("Overflow");
}
}