Пример #1
0
int main()
{	

	//创建一个空的栈,pS指针指向该栈
	PSTACK pS = create_stack();
	push_stack(pS,4);
	push_stack(pS,3);
	push_stack(pS,7);
	push_stack(pS,1);
	push_stack(pS,5);
	push_stack(pS,9);
	push_stack(pS,2);
	push_stack(pS,6);

	printf("Befote Sorted:\n");
	traverse_stack(pS);
	PSTACK pS1 = sort_stack(pS);
	printf("After Sorted:\n");
	traverse_stack(pS1);
	return 0;
}
Пример #2
0
int main()
{
	struct nodeStack *top=NULL;
	push(&top,10);
	push(&top,11);
	push(&top,12);
	push(&top,14);

	pop(&top);
	pop(&top);
	
	traverse_stack(&top);
		
	return 0;
}