mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 13:31:21 +03:00
Modified stack.c
This commit is contained in:
parent
d192a0ab37
commit
0fdb6766b7
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user