Example #1
0
int pop2( stackNode2Ptr *topPtr ){
	stackNode2Ptr stack = *topPtr;
	if (isEmpty2(stack)){
		return 0;
	}
	//get the node to be deleted
	stackNode2Ptr temp = stack->nextPtr;
	//set the new top of the stack
	stack->nextPtr = temp->nextPtr;
	//get the data to return
	int pop2 = temp->data;
	//free the memory
	free(temp);
	return pop2;
}
Example #2
0
int pop2(struct TwoStack * twoStack) {
  if (isEmpty2(twoStack))
    return INT_MIN;
  return twoStack->array[twoStack->top2++];
}