Conciseness.
This commit is contained in:
parent
3d421f31d3
commit
539c0ecb00
@ -58,11 +58,9 @@ bool empty(struct stack *stack) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int length(struct stack *stack) {
|
int length(struct stack *stack) {
|
||||||
int length;
|
int length = 0;
|
||||||
|
|
||||||
if (empty(stack)) {
|
if (!empty(stack)) {
|
||||||
length = 0;
|
|
||||||
} else {
|
|
||||||
for (length = 1; stack->next; stack = stack->next, length++)
|
for (length = 1; stack->next; stack = stack->next, length++)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user