Modified stack.c

This commit is contained in:
KylerSmith 2017-07-15 19:46:31 -07:00
parent d192a0ab37
commit 0fdb6766b7

View File

@ -115,6 +115,9 @@ int pop() {
return returnData; return returnData;
} }
/**
* Returns the next value to be popped.
*/
int peek() { int peek() {
if(head != NULL) if(head != NULL)
return head->data; return head->data;
@ -124,10 +127,16 @@ int peek() {
} }
} }
/**
* Returns the size of the stack.
*/
int size() { int size() {
return count; return count;
} }
/**
* Returns 1 if stack is empty, returns 0 if not empty.
*/
int isEmpty() { int isEmpty() {
if(count == 0) if(count == 0)
return 1; return 1;