mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 05:21:49 +03:00
Modified stack.c
This commit is contained in:
parent
d192a0ab37
commit
0fdb6766b7
@ -115,6 +115,9 @@ int pop() {
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the next value to be popped.
|
||||
*/
|
||||
int peek() {
|
||||
if(head != NULL)
|
||||
return head->data;
|
||||
@ -124,10 +127,16 @@ int peek() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size of the stack.
|
||||
*/
|
||||
int size() {
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns 1 if stack is empty, returns 0 if not empty.
|
||||
*/
|
||||
int isEmpty() {
|
||||
if(count == 0)
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user