Skip to content

Commit a54e787

Browse files
authored
Merge pull request #61 from sadeem-albir/patch-3
Fixed bugs in stack.c
2 parents 7f3097e + 83e2460 commit a54e787

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

chapter_4/exercise_4_04/stack.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ void swap(void)
158158

159159
void clear(void)
160160
{
161-
do
161+
while (sp > 0)
162162
{
163-
stack[sp] = 0.0;
164-
} while (sp--);
163+
stack[--sp] = 0.0;
164+
}
165165
}
166166

167167
int bufp = 0;

0 commit comments

Comments
 (0)