diff options
| author | mo khan <mo.khan@gmail.com> | 2020-07-04 16:39:12 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-07-04 16:39:12 -0600 |
| commit | b8461ad82f21c7349ef90d7b703721f01f9a2174 (patch) | |
| tree | 1220dd42ce4ee9f9b0c4a0bd2474e1b9f44488d3 /src/01 | |
| parent | c52aa3f75385c5618ab6bd5ab279775c4da2d1ae (diff) | |
Format the program profile
Diffstat (limited to 'src/01')
| -rw-r--r-- | src/01/01b/README.md | 40 | ||||
| -rw-r--r-- | src/01/01b/main.c | 6 |
2 files changed, 21 insertions, 25 deletions
diff --git a/src/01/01b/README.md b/src/01/01b/README.md index 4bf8070..b1f6f48 100644 --- a/src/01/01b/README.md +++ b/src/01/01b/README.md @@ -19,7 +19,8 @@ The implementation of the `pop()` function operates in linear time `O(n)`. ## Errors and Warnings -The design this program I used [cgreen](https://cgreen-devs.github.io/) to unit test the pseudo public +For the design of this program I used +[c-green](https://cgreen-devs.github.io/) to unit test the pseudo public functions of the Stack interface. The [`stack_test.c`](./stack_test.c) file includes unit tests to cover the following scenarios: @@ -45,6 +46,7 @@ Completed "main": 5 passes in 1ms. ```bash モ make run +clang -c -o build/main.o main.c clang build/stack.o build/main.o -o build/program ./build/program === COMP-272 - Assignment 1 - Question 1b === @@ -59,28 +61,22 @@ Push: 492 Push: 649 Push: 421 -[383,886,777,915,793,335,386,492,649,421] -Pop: 421 -[383,886,777,915,793,335,386,492,649] -Pop: 649 -[383,886,777,915,793,335,386,492] -Pop: 492 -[383,886,777,915,793,335,386] -Pop: 386 -[383,886,777,915,793,335] -Pop: 335 -[383,886,777,915,793] -Pop: 793 -[383,886,777,915] -Pop: 915 -[383,886,777] -Pop: 777 -[383,886] -Pop: 886 -[383] -Pop: 383 -[] +Stack: [383,886,777,915,793,335,386,492,649,421] + Pop: 421 [383,886,777,915,793,335,386,492,649] + Pop: 649 [383,886,777,915,793,335,386,492] + Pop: 492 [383,886,777,915,793,335,386] + Pop: 386 [383,886,777,915,793,335] + Pop: 335 [383,886,777,915,793] + Pop: 793 [383,886,777,915] + Pop: 915 [383,886,777] + Pop: 777 [383,886] + Pop: 886 [383] + Pop: 383 [] + Bye ``` ## Discussion + +This implementation of a Stack can hold a maximum of 2^32 number of items. +Once the Stack is full it stops accepting new items to push. diff --git a/src/01/01b/main.c b/src/01/01b/main.c index 7fb8165..41188d0 100644 --- a/src/01/01b/main.c +++ b/src/01/01b/main.c @@ -14,13 +14,13 @@ int main(int argc, char *argv[]) push(stack, data); } - printf("\n"); + printf("\nStack:\t\t"); inspect(stack->q1); while (size(stack) > 0) { - printf("Pop: %d\n", pop(stack)); + printf(" Pop: %d\t", pop(stack)); inspect(stack->q1); } - printf("Bye\n"); + printf("\nBye\n"); return 0; } |
