I am writing a dynamic stack linked list.I have written a stack using double linked list but when i am trying to do this by using single linked list it aint working i just used the linked list code and modified the append function to function like push and also the pop function.
please help me the error it is showing on compilation is as follows

stack.c: In function ‘push’:
stack.c:15: error: request for member ‘next’ in something not a structure or union
stack.c: In function ‘pop’:
stack.c:25: error: request for member ‘val’ in something not a structure or union
stack.c:26: error: request for member ‘next’ in something not a structure or union
stack.c: In function ‘print’:
stack.c:37: error: request for member ‘val’ in something not a structure or union
stack.c:38: error: request for member ‘next’ in something not a structure or union

the code is as follows


STACK.H header file


Code:
#include<limits.h>
#include<stdio.h>
#include<errno.h>
#include<stdlib.h>

typedef struct node{
	int val;
	struct node *next;
 	}node;

typedef struct node *stack;
int pop(stack *s);
void push(stack *s,int val);
void print(stack s);
void init(stack *s);


Stack.c

Code:
#include"stack.h"


void push(stack *s,int val){
	node *tmp;
	tmp = (node *) malloc(sizeof(node));
	if(tmp==NULL){
		printf("\nNo Memory Exitting ");
		exit(0);
	}
	tmp->val=val;
		
	if(s == NULL || *s == NULL){
		*s=tmp;
		s->next=NULL;	
		return;
	}	
	tmp->next=*s;	
	*s=tmp;
}


int pop(stack *s){
	int val;
	val=s->val;
	s=s->next;
	//free(s);
}

void init(stack *s){
	*s = NULL;
}

void print(stack s){
	printf("\n\nThe Stack \n");	
	while(s != NULL){
		printf("%d\n",s.val);
		s=s.next;	
	}
}
void main(){
	int ch,val;
	stack st;
	init(&st);
	do{	
		printf("\n1.Push\n2.Pop\n3.Print\n4.Exit\nChoice - ");
		scanf("%d",&ch);
		if(ch==1){	
			printf("\n\nEnter the value - ");
			scanf("%d",&val);
			push(&st,val);
		}
		else if(ch==2){
			printf("\n\nThe Deleted Number is - ");
			printf("%d",pop(&st));
		}
		else if(ch==3){
			print(st);
		}
		else if(ch==4){
			exit(12);
		}
		else{
			printf("\nInvalid Entry");
		}
	}while(1);
}

please help me the error is really annoying the linked list code that i modified works perfectly which is the following


Code:
#include<limits.h>
#include<stdio.h>
#include<errno.h>

typedef struct node{
	int val;
	struct node *next;
	}node;

typedef struct node *ll;
int length(ll p);
void append(ll *p,int val);
void traverse(ll p);
void init(ll *p);
#include"ll.h"
#include<stdlib.h>

void init(ll *p){
	*p = NULL;
}
int length(ll p){
	int count=0;
		
	while(p->next != NULL){
		p=p->next;
		count++;
	}
	return count;
}

void append(ll *p,int val){
	
	node *tmp;	
	node *q;
	q=*p;	
	tmp = (node *) malloc(sizeof(node));
	tmp->val=val;
	if(p == NULL || *p == NULL)
	{
		
		tmp->next=NULL;
		*p=tmp;		
		return;
	}	
	while(q->next != NULL){
		q=q->next;
	}	
	tmp->next=NULL;
	q->next = tmp;
	q->next->val=val;
	q->next->next=NULL;	
	//free(q);	
}

void traverse(ll p)
{	printf("\n\n[ ");
	while(p != NULL){
		printf(" %d",p->val);
		p=p->next;
	}
	printf(" ]\n\n");
}


the above code works perfectly please help me