The array implementation of a stack is very simple. We only
need to wrap an array ADT in a stack data type. In other words, we can
reuse the array ADT concepts in module 0036.
In the header file stack.h
, we can define a fake structure
as follows:
struct Stack
{
};
In the source file stack.c
, we can simply cast all (struct Stack *)
to (struct ArrayADT *)
.
Subsections
Copyright © 2006-10-23 by Tak Auyeung