#include<stdlib.h>structthing{intsize;/* size of contents */intbottom;/* first used location */inttop;/* first unused location */int*elements;/* array of elements */};structthing*thingCreate(intsize){structthing*t;t=malloc(sizeof(*t));t->size=size;t->bottom=t->top=0;t->elements=malloc(sizeof(int)*size);returnt;}voidPush(structthing*t,intvalue){t->elements[t->top++]=value;}intPop(structthing*t){returnt->elements[t->bottom++];}
Your answer seems reasonable.
Find out if you're right!