Merge pull request #243 from megahertz66/work

fix the stack.c
This commit is contained in:
Hai Hoang Dang 2019-07-19 10:28:01 -07:00 committed by GitHub
commit 5d7caa8328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,7 +42,7 @@ void initStack()
grow: increases the stack by 10 elements.
This utility function isn't part of the public interface
*/
void grow()
void grow()
{
max += 10; /* increases the capacity */
@ -54,8 +54,9 @@ void grow()
{
*(tmp + i) = *(array + i);
}
array = tmp; /* setups the new one as basis */
/*free the memory */
free(array);
array = tmp;
}
/* push: pushs the argument onto the stack */
@ -133,4 +134,4 @@ void *top()
{
/* offset address points to the top element */
return array[offset];
}
}