stuff
This commit is contained in:
BIN
01-StackMachine/.DS_Store
vendored
Normal file
BIN
01-StackMachine/.DS_Store
vendored
Normal file
Binary file not shown.
13
01-StackMachine/Makefile
Normal file
13
01-StackMachine/Makefile
Normal file
@@ -0,0 +1,13 @@
|
||||
CC=gcc
|
||||
CFLAGS=-Wall -g
|
||||
|
||||
all: smTester
|
||||
|
||||
smTester: stackm.o smTester.o
|
||||
$(CC) -o smTester $^
|
||||
|
||||
%: %.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
clean:
|
||||
rm -f smTester *.o
|
||||
253
01-StackMachine/StackMachine.md
Normal file
253
01-StackMachine/StackMachine.md
Normal file
@@ -0,0 +1,253 @@
|
||||
## Introduction
|
||||
|
||||
The purpose of this lab is to design, code, and test a machine within the confines of the C programming language. The machine will consist of a data structure for storing data and operations that can be done against the data structure to perform calculations. While not strictly and "operating systems" exercise, it is intended to familiarize you with the development process on Linux and provide additional practice with dynamic memory.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Your VM should be operational, and you should have a development environment (programmer's editor or IDE) setup and tested (i.e. you have written a hello world program). This assignment will also make use of the program 'valgrind' which may need to be installed. You can do this at the command line with the commands:
|
||||
|
||||
```text
|
||||
sudo apt update
|
||||
sudo apt install valgrind
|
||||
```
|
||||
|
||||
## Background
|
||||
|
||||
A stack machine is a type of computer architecture in which values are stored on a stack rather than in general purpose registers. Values can be pushed from memory onto the stack and/or popped from the stack and stored into memory. Numerical operations are performed on items currently on the stack. For example, to execute an 'add' operation, the two operands are first pushed onto the stack. Then the 'add' instruction is executed which pops the values off the stack, adds them, and the result is pushed back on top of the stack.
|
||||
|
||||
While it might seem that using general purpose registers makes for a more flexible processor architecture, there are advantages of the simplicity of a stack machine. For example, there is no need for hardware to decode and access the register file, all operations are performed against the top of the stack. In fact, the Java Virtual Machine (JVM) is implemented in part as a stack machine.
|
||||
|
||||
## The Exercise
|
||||
|
||||
For this exercise you will be creating a program that can perform operations using a stack machine. The machine has no memory so all values for computation are stored entirely on the stack. Typically, a stack machine interprets instructions through machine code that has been compiled for the architecture, however, our stack machine will use function calls to perform operations.
|
||||
|
||||
The stack is a first-in-last-out data structure. Items are pushed (inserted) onto the top of the stack and popped (removed) from the top of the stack. The first thing pushed into the stack is therefore the last thing that can be removed. Think of it like stacking blocks on top of each other. You can't move the bottom block without first removing all the blocks on top of it.
|
||||
|
||||
Beyond push and pop, our stack machine can perform mathematical operations add, subtract, and multiply as well as a special operation called rotate which rotates elements on the stack.
|
||||
The size (number of elements it can hold) of the stack is unbounded, so you must be able to dynamically allocate and free elements as needed.
|
||||
|
||||
## Development
|
||||
|
||||
Start by downloading the [starter files](stackm.zip) which include the header file with the stack machine definition along with all required stack functions. The starter code also contains a sample smTester.c file with some test cases and a Makefile.
|
||||
|
||||
A header file is supplied that represents the "public" interface that you must implement. Each function is documented within the head file. You are ***NOT*** allowed to change this header file in any way. You should supply ***ONE*** source file with the implementation for all functions (stackm.c).
|
||||
|
||||
Upon reviewing the header file, you may have some impressions. First, the stack is rather crude. The functions in this "public" interface only manage the stack's memory and organization. The user has full access to the internals. Of course, some of this is an artifact of the C language that does not include the protections provided by languages such as Java and C++. Also note that the user must pass a pointer to every stack management function. Again, a necessity due to the lack of object-oriented language features.
|
||||
|
||||
In addition to the stack machine implementation, supply a "driver" that will completely test your stack machine implementation. Here is an example test driver, however it is not all-inclusive.
|
||||
|
||||
```c
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
|
||||
smPush(&mystack, 2);
|
||||
smPush(&mystack, 3);
|
||||
smPush(&mystack, 4);
|
||||
smPrint(&mystack);
|
||||
|
||||
smPop(&mystack);
|
||||
smPrint(&mystack);
|
||||
smAdd(&mystack);
|
||||
smPrint(&mystack);
|
||||
|
||||
int value = 0;
|
||||
smTop(&mystack, &value);
|
||||
printf("%d\n", value);
|
||||
|
||||
smPush(&mystack, 10);
|
||||
smPush(&mystack, 11);
|
||||
smPrint(&mystack);
|
||||
smMult(&mystack);
|
||||
smPrint(&mystack);
|
||||
|
||||
smPush(&mystack, 10);
|
||||
smPush(&mystack, 11);
|
||||
smPrint(&mystack);
|
||||
smRotate(&mystack, 5);
|
||||
smPrint(&mystack);
|
||||
|
||||
smClear(&mystack);
|
||||
smPrint(&mystack);
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
You should have already picked an editor or IDE to use. Compiling at the command line is sometimes easier than using an IDE as IDEs sometimes hide error messages. Edit, compile, and run your program entirely from the Linux VM. Using Windows to edit the file and then transferring to Linux can cause formatting problems with the code and might introduce unexpected errors.
|
||||
|
||||
You can invoke the compiler at the command line directly:
|
||||
|
||||
```text
|
||||
gcc hello.c
|
||||
```
|
||||
|
||||
This command will build hello.c and product an executable name a.out in the same directory. Errors and warning will be reported to the console. You can run a.out by issuing the command:
|
||||
|
||||
```text
|
||||
./a.out
|
||||
```
|
||||
|
||||
Here, the '.' refers to the current directory.
|
||||
|
||||
We can get fancier. Instead of the default output name, we can specify the name of the executable:
|
||||
|
||||
```text
|
||||
gcc -o hello hello.c
|
||||
```
|
||||
|
||||
If we have more than one source file, just list them all:
|
||||
|
||||
```text
|
||||
gcc -o hello hello.c goodbye.c
|
||||
```
|
||||
|
||||
By default, gcc doesn't report all possible warnings. If you want more warnings (hint, you do), do this:
|
||||
|
||||
```text
|
||||
gcc -Wall -o hello hello.c goodbye.c
|
||||
```
|
||||
|
||||
Another option for compiling your program is to use a Makefile. Doing so is completely optional for this lab but can be very helpful for building your programs. Dr. Schilling has an excellent tutorial on Makefiles that you can watch here: [https://www.youtube.com/watch?v=gT2roSrSYfo&feature=youtu.be](https://www.youtube.com/watch?v=gT2roSrSYfo&feature=youtu.be)
|
||||
|
||||
Here is a skeleton Makefile that you can use to get you started.
|
||||
|
||||
```text
|
||||
CC=gcc
|
||||
CFLAGS=-c -Wall
|
||||
LDFLAGS=
|
||||
SOURCES=source1.c source2.c
|
||||
OBJECTS=$(SOURCES:.c=.o)
|
||||
EXECUTABLE=exename
|
||||
|
||||
all: $(SOURCES) $(EXECUTABLE)
|
||||
|
||||
$(EXECUTABLE): $(OBJECTS)
|
||||
$(CC) $(LDFLAGS) $(OBJECTS) -o $@
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
clean:
|
||||
rm -rf $(OBJECTS) $(EXECUTABLE)
|
||||
```
|
||||
|
||||
## Testing and Debugging
|
||||
|
||||
As stated above, you must write a driver that completely tests your stack machine. So what is complete testing? How do you go about this? You will have to put some thought into this and use your experience to guide you. It would make sense that you will have to call every method at least once, probably many times under different conditions. Look for boundary cases. For example, be sure to test ```smPop()``` with an empty stack as well as a non-empty stack.
|
||||
|
||||
Given that we are using C and not Java, there are few protections we can build in to prevent misuse of the stack. For example, there is no perfect way to make sure ```smInit()``` is called before adding items to the stack.
|
||||
|
||||
So, you are calling all the methods, and your program crashes. What now? Well, you must track down where it is crashing. An IDE with debugging will be helpful, but you can also do this with gdb from the command.
|
||||
|
||||
NOTE: The gdb program requires additional debug symbols to be included in your program in order to correctly display information about variable names and function names in call stacks. To compile your program with additional debugging information, use the -g flag. For example:
|
||||
|
||||
```text
|
||||
gcc -g -Wall -o hello hello.c goodbye.c
|
||||
```
|
||||
|
||||
The following shows a sample session using gdb to debug a segmentation fault:
|
||||
|
||||
```text
|
||||
~/dev/labs/stack$ ./a.out
|
||||
Segmentation fault
|
||||
~/dev/labs/stack$ gdb ./a.out
|
||||
GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
|
||||
|
||||
== chopped out copyright stuff ==
|
||||
|
||||
Reading symbols from ./a.out...done.
|
||||
(gdb) run
|
||||
Starting program: ~/dev/labs/stack/a.out
|
||||
|
||||
Program received signal SIGSEGV, Segmentation fault.
|
||||
0x0000555555554b3b in smPush (myStack=0x7fffffffe120, toStore=4) at stackm.c:123
|
||||
123 myStack->top->next = newNode;
|
||||
(gdb) bt
|
||||
#0 0x0000555555554b3b in smPush (myStack=0x7fffffffe120, toStore=4) at stackm.c:123
|
||||
#1 0x00005555555548a4 in main () at smTester.c:30
|
||||
(gdb)
|
||||
```
|
||||
|
||||
- Running the program directly with ```./a.out``` from the command line produces a Segmentation fault output. This is not particularly helpful.
|
||||
- Running ```gdb``` with the program as a command line argument runs the GNU debugger. Notice the ```(gdb)``` prompt.
|
||||
- Using the ```run``` command will execute the program in the debugger
|
||||
- When the program hits the Segmentation fault, using the backtrace (```bt```) command prints a trace similar to the stack trace received from a ```NullPointerException``` in Java outlining exactly where the problem happened.
|
||||
|
||||
Another, highly recommended, tool for you to use is valgrind. Valgrind will monitor the heap and report memory leaks. The program must run to completion for this to be useful. Sample output is below:
|
||||
|
||||
```text
|
||||
==10565== Memcheck, a memory error detector
|
||||
==10565== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
|
||||
==10565== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
|
||||
==10565== Command: ./a.out
|
||||
==10565==
|
||||
==10565==
|
||||
==10565== HEAP SUMMARY:
|
||||
==10565== in use at exit: 100 bytes in 10 blocks
|
||||
==10565== total heap usage: 10 allocs, 0 frees, 100 bytes allocated
|
||||
==10565==
|
||||
==10565== LEAK SUMMARY:
|
||||
==10565== definitely lost: 100 bytes in 10 blocks
|
||||
==10565== indirectly lost: 0 bytes in 0 blocks
|
||||
==10565== possibly lost: 0 bytes in 0 blocks
|
||||
==10565== still reachable: 0 bytes in 0 blocks
|
||||
==10565== suppressed: 0 bytes in 0 blocks
|
||||
==10565== Rerun with --leak-check=full to see details of leaked memory
|
||||
==10565==
|
||||
==10565== For lists of detected and suppressed errors, rerun with: -s
|
||||
==10565== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
|
||||
```
|
||||
|
||||
## Deliverables
|
||||
|
||||
You should have at least three source files in your project:
|
||||
|
||||
1. smTester.c – The test driver for your stack machine and should contain the 'main' function. Make sure your implemented test driver tests more than just the sample
|
||||
2. stackm.c – the implementation file for your stack machine operations
|
||||
3. stackm.h – the header file that defines the stack machine operations
|
||||
|
||||
A makefile is useful, but optional for this assignment. If you created a makefile, include it in your submission.
|
||||
|
||||
All files should be well documented with function comment blocks and inline comments that explain complicated code routines. While no explicit style guidelines are set for programming in this course, code should be documented and readable. Include your name, section, and lab name in a comment block at the top of each file, including the given header file.
|
||||
|
||||
NOTE: do ***NOT*** submit any IDE configuration files (.idea, project files, etc.). Only submit your source files and report.
|
||||
|
||||
Prepare a lab report and submit it along with your source code. The report should include the following:
|
||||
|
||||
- Your name, date, and lab title
|
||||
- Introduction – a description of the lab in your own words
|
||||
- Design and Testing Methodology – a description of your design decisions and the process you took to create your test driver
|
||||
- Resources – a description of any external resources you used to complete the lab
|
||||
- Build – instructions on how to build and run your program. Include the exact commands that are necessary
|
||||
- Analysis – Discuss the key concepts from the lab and answers to the following questions
|
||||
- All the stack machine functions need a "reference" to the stack structure, and according to this design, that stack reference is passed as a pointer. Why is this necessary? Do all the stack functions need this to be passed as a pointer? Any exceptions? Be specific in your answer.
|
||||
- Unlike a Java or C++ implementation, this implementation cannot "hide" any of the internal structure of the stack. That is, users of the stack could mess up the next pointers if they are careless. Can you think of any way we could hide the structure of the stack to lessen the chances a user will mess up the stack? Describe in brief detail.
|
||||
- What if all smClear() did was assign NULL to top in the stack structure and nothing else. Would the program crash? Would there be any side effects? Try it and report results.
|
||||
- Give an example of why it might be helpful to provide an iterator or random access to elements stored in the stack (rather than always accessing the top) and outline how you could implement such a feature.
|
||||
- Conclusion
|
||||
- Summary of what you learned in the lab
|
||||
- What specifically was challenging about this lab?
|
||||
- What did you like about it?
|
||||
- What could we do to improve it for others?
|
||||
|
||||
NOTE: You should ensure that this program compiles without warning (-Wall and -Wextra) prior to submitting.
|
||||
|
||||
Create a zip file containing your source files and your report and submit the zip file per your instructor's instructions.
|
||||
|
||||
## Grading Criteria (100 Points)
|
||||
|
||||
- (35 Points) Report
|
||||
- (5 Points) Report Introduction - Thorough description of the lab in your own words.
|
||||
- (5 Points) Design and Testing Methodology - Detailed description of design and method for testing your implementation.
|
||||
- (20 Points) Analysis - Answers to the analysis questions
|
||||
- (5 Points) Conclusion - Thorough conclusion with description of what you learned, what you liked, and suggestions for lab improvements.
|
||||
- (5 Points) Documented Resources - Description of external resources used to complete the lab
|
||||
- (5 Points) Correct Submission - Followed submission instructions (e.g. IDE project files are not submitted)
|
||||
- (5 Points) Build - Code compiles without warnings or errors
|
||||
- (10 Points) Test Cases - Thoroughness of submitted test driver
|
||||
- (35 Points) Instructor Tests - Implementation passes all instructor test cases
|
||||
- (5 Points) Memory Management - Program execution is free from memory leaks
|
||||
37
01-StackMachine/smTester.c
Normal file
37
01-StackMachine/smTester.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
|
||||
smPush(&mystack, 2);
|
||||
smPush(&mystack, 3);
|
||||
smPush(&mystack, 4);
|
||||
smPrint(&mystack);
|
||||
|
||||
smPop(&mystack);
|
||||
smPrint(&mystack);
|
||||
smAdd(&mystack);
|
||||
smPrint(&mystack);
|
||||
|
||||
int value = 0;
|
||||
smTop(&mystack, &value);
|
||||
printf("%d\n", value);
|
||||
|
||||
smPush(&mystack, 10);
|
||||
smPush(&mystack, 11);
|
||||
smPrint(&mystack);
|
||||
smMult(&mystack);
|
||||
smPrint(&mystack);
|
||||
|
||||
smPush(&mystack, 10);
|
||||
smPush(&mystack, 11);
|
||||
smPrint(&mystack);
|
||||
smRotate(&mystack, 5);
|
||||
smPrint(&mystack);
|
||||
|
||||
smClear(&mystack);
|
||||
smPrint(&mystack);
|
||||
return 0;
|
||||
}
|
||||
195
01-StackMachine/stackm.h
Normal file
195
01-StackMachine/stackm.h
Normal file
@@ -0,0 +1,195 @@
|
||||
/* stackm.h
|
||||
*
|
||||
* External (public) declarations for stack machine in C.
|
||||
*
|
||||
* This stack will know about the top. Each element must point
|
||||
* to the one below it in the stack.
|
||||
*
|
||||
* Note that the pop operations do not return a reference to the
|
||||
* popped node. This would require storage for the node to be
|
||||
* released by the user, which could lead to memory mishandling.
|
||||
* The stack size is unbounded so memory must be allocated and
|
||||
* freed as appropriate when operations are performed.
|
||||
*
|
||||
* This stack will only hold integers. Mathematical operations are
|
||||
* performed on elements on the top of the stack as described in the
|
||||
* function definitions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef STACKM_H
|
||||
#define STACKM_H
|
||||
|
||||
/* Structures */
|
||||
|
||||
/* a stack node */
|
||||
typedef struct node {
|
||||
int value;
|
||||
struct node* next;
|
||||
} node;
|
||||
|
||||
/* The stack itself */
|
||||
typedef struct stackm {
|
||||
struct node *top;
|
||||
} stackm;
|
||||
|
||||
/* Stack Machine methods
|
||||
*
|
||||
* These methods are used to create and operate on the stack machine as a whole.
|
||||
*/
|
||||
|
||||
/* smInit()
|
||||
* Initialize a stack machine structure. An empty stack will
|
||||
* be characterized by top being NULL.
|
||||
* Parameters: myStack - a pointer to the structure to be init
|
||||
* Returns: void
|
||||
*/
|
||||
void smInit(struct stackm *myStack);
|
||||
|
||||
/* smSize()
|
||||
* Reports the current size of the stack. Will need to iterate
|
||||
* the stack to get this data size there is no size property, nor
|
||||
* can there really be one given that users can access nodes.
|
||||
* Parameters: myStack - the stack
|
||||
* Returns: int, size of stack
|
||||
*/
|
||||
int smSize(struct stackm *myStack);
|
||||
|
||||
/* smPush()
|
||||
* Add a new node with provided data to the top of the stack.
|
||||
* This method should allocate memory as needed and check to
|
||||
* make sure that the memory was allocated successfully.
|
||||
* Parameters: myStack - the stack
|
||||
* toStore - the value to store
|
||||
* Returns: int - 0 if no push could be performed
|
||||
* (failed to allocate memory) or non-zero
|
||||
* if push was successful
|
||||
*/
|
||||
int smPush(struct stackm *myStack, int toStore);
|
||||
|
||||
/* smPop()
|
||||
* Removes top item in stack. Note, this does not return
|
||||
* any data from the stack. If the data in the node is needed
|
||||
* it should be accessed prior to the pop (smTop).
|
||||
* Parameters: myStack - the stack
|
||||
* Returns: int - 0 if no pop (stack was empty) or non-zero
|
||||
* if pop successful
|
||||
*/
|
||||
int smPop(struct stackm *myStack);
|
||||
|
||||
/* smTop()
|
||||
* return the value at the top of the stack. NOTE: the value
|
||||
* must be returned by dereferencing the passed in pointer.
|
||||
* The function must make sure the pointer is not NULL prior to
|
||||
* dereferencing to avoid memory violations.
|
||||
* Parameters: myStack - the stack
|
||||
* toStore - a point to store the stack top value
|
||||
* Returns: int - 0 if top could not be retrieved
|
||||
* (toStore was NULL or stack is empty) or
|
||||
* non-zero retrieval was successful
|
||||
*/
|
||||
int smTop(struct stackm *myStack, int* toStore);
|
||||
|
||||
/* smClear()
|
||||
* Clears all nodes and releases all dynamic memory. Stack
|
||||
* structure should be NULLed and can be reused.
|
||||
* Parameters: myStack - the stack
|
||||
* Returns: nothing
|
||||
*/
|
||||
void smClear(struct stackm *myStack);
|
||||
|
||||
/* smPrint()
|
||||
* Prints the contents of the stack machine to standard output.
|
||||
* When printing it should be clear what value contains the top
|
||||
* as well which which values are stacked on top of other values
|
||||
* Parameters: myStack - the stack
|
||||
* Returns: nothing
|
||||
*/
|
||||
void smPrint(struct stackm *myStack);
|
||||
|
||||
/* Stack Machine manipulation methods
|
||||
*
|
||||
* These methods perform operations that manipulate the stack
|
||||
* (math or element ordering).
|
||||
*/
|
||||
|
||||
/* smAdd()
|
||||
* Add together the top two elements of the stack and push
|
||||
* the result.
|
||||
* The stack must contain at least 2 elements for this
|
||||
* operation to be successful.
|
||||
* Any removed element must be freed (no memory leaks)
|
||||
* Parameters: myStack - the stack
|
||||
* Returns: int - 0 if operation could not be performed
|
||||
* (not enough elements on the stack)
|
||||
* non-zero if successful
|
||||
*/
|
||||
int smAdd(struct stackm* myStack);
|
||||
|
||||
/* smSub()
|
||||
* Subtract the top two elements of the stack and push
|
||||
* the result.
|
||||
* The stack must contain at least 2 elements for this
|
||||
* operation to be successful.
|
||||
* Operation is TOS (top of stack) - 2nd from TOS
|
||||
* if the stack contained the values:
|
||||
* top -> 6
|
||||
* 5
|
||||
* 4
|
||||
* bottom -> 3
|
||||
* The result after a smSub operation would be:
|
||||
* top -> 1
|
||||
* 4
|
||||
* bottom -> 3
|
||||
* 6 - 5 = 1
|
||||
* Any removed element must be freed (no memory leaks)
|
||||
* Parameters: myStack - the stack
|
||||
* Returns: int - 0 if operation could not be performed
|
||||
* (not enough elements on the stack)
|
||||
* non-zero if successful
|
||||
*/
|
||||
int smSub(struct stackm* myStack);
|
||||
|
||||
/* smMult()
|
||||
* Multiply the top two elements of the stack and push
|
||||
* the result.
|
||||
* The stack must contain at least 2 elements for this
|
||||
* operation to be successful.
|
||||
* Any removed element must be freed (no memory leaks)
|
||||
* Parameters: myStack - the stack
|
||||
* Returns: int - 0 if operation could not be performed
|
||||
* (not enough elements on the stack)
|
||||
* non-zero if successful
|
||||
*/
|
||||
int smMult(struct stackm* myStack);
|
||||
|
||||
/* smRotate()
|
||||
* Rotate the top 'n' elements of the stack. For example,
|
||||
* if the stack contained the values:
|
||||
* top -> 6
|
||||
* 5
|
||||
* 4
|
||||
* bottom -> 3
|
||||
* The result after a rotate 3 operation would be:
|
||||
* top -> 5
|
||||
* 4
|
||||
* 6
|
||||
* bottom -> 3
|
||||
* NOTE: the top element on the stack goes to the 'nth'
|
||||
* location and every element above the 'nth' location
|
||||
* gets moved up one
|
||||
* The stack must contain at least 'n' elements for this
|
||||
* operation to be successful.
|
||||
* 'n' must be greater than or equal to 1. A value of 1
|
||||
* does nothing, but is still successfull.
|
||||
* Any removed element must be freed (no memory leaks)
|
||||
* Parameters: myStack - the stack
|
||||
* depth - the depth of the rotation
|
||||
* Returns: int - 0 if operation could not be performed
|
||||
* (not enough elements on the stack
|
||||
* or depth is too small)
|
||||
* non-zero if successful
|
||||
*/
|
||||
int smRotate(struct stackm* myStack, int depth);
|
||||
|
||||
#endif
|
||||
8
01-StackMachine/testcases/tc1.c
Normal file
8
01-StackMachine/testcases/tc1.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
return 0;
|
||||
}
|
||||
30
01-StackMachine/testcases/tc10.c
Normal file
30
01-StackMachine/testcases/tc10.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
smPrint(&mystack);
|
||||
doPush(&mystack, 2);
|
||||
smPrint(&mystack);
|
||||
doPush(&mystack, 3);
|
||||
smPrint(&mystack);
|
||||
doPop(&mystack);
|
||||
smPrint(&mystack);
|
||||
doPop(&mystack);
|
||||
smPrint(&mystack);
|
||||
doPop(&mystack);
|
||||
smPrint(&mystack);
|
||||
return 0;
|
||||
}
|
||||
27
01-StackMachine/testcases/tc11.c
Normal file
27
01-StackMachine/testcases/tc11.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doAdd(stackm* s)
|
||||
{
|
||||
printf("Add Ret: %d\n", smAdd(s));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPush(&mystack, 2);
|
||||
doAdd(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
39
01-StackMachine/testcases/tc12.c
Normal file
39
01-StackMachine/testcases/tc12.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doAdd(stackm* s)
|
||||
{
|
||||
printf("Add Ret: %d\n", smAdd(s));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doTop(stackm* s, int* v)
|
||||
{
|
||||
printf("Top Ret: %d\n", smTop(s, v));
|
||||
}
|
||||
|
||||
int main() {
|
||||
int val = 0;
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 0 ; i < 10; i++) {
|
||||
doPush(&mystack, i);
|
||||
}
|
||||
for(int i = 0; i < 9; i++) {
|
||||
doAdd(&mystack);
|
||||
}
|
||||
doTop(&mystack, &val);
|
||||
printf("Final Val: %d\n", val);
|
||||
doPop(&mystack);
|
||||
|
||||
return 0;
|
||||
}
|
||||
27
01-StackMachine/testcases/tc13.c
Normal file
27
01-StackMachine/testcases/tc13.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doSub(stackm* s)
|
||||
{
|
||||
printf("Sub Ret: %d\n", smSub(s));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPush(&mystack, 2);
|
||||
doSub(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
39
01-StackMachine/testcases/tc14.c
Normal file
39
01-StackMachine/testcases/tc14.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doSub(stackm* s)
|
||||
{
|
||||
printf("Sub Ret: %d\n", smSub(s));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doTop(stackm* s, int* v)
|
||||
{
|
||||
printf("Top Ret: %d\n", smTop(s, v));
|
||||
}
|
||||
|
||||
int main() {
|
||||
int val = 0;
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 0 ; i < 10; i++) {
|
||||
doPush(&mystack, i);
|
||||
}
|
||||
for(int i = 0; i < 9; i++) {
|
||||
doSub(&mystack);
|
||||
}
|
||||
doTop(&mystack, &val);
|
||||
printf("Final Val: %d\n", val);
|
||||
doPop(&mystack);
|
||||
|
||||
return 0;
|
||||
}
|
||||
27
01-StackMachine/testcases/tc15.c
Normal file
27
01-StackMachine/testcases/tc15.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doMult(stackm* s)
|
||||
{
|
||||
printf("Mult Ret: %d\n", smMult(s));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPush(&mystack, 2);
|
||||
doMult(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
39
01-StackMachine/testcases/tc16.c
Normal file
39
01-StackMachine/testcases/tc16.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doMult(stackm* s)
|
||||
{
|
||||
printf("Mult Ret: %d\n", smMult(s));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doTop(stackm* s, int* v)
|
||||
{
|
||||
printf("Top Ret: %d\n", smTop(s, v));
|
||||
}
|
||||
|
||||
int main() {
|
||||
int val = 0;
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 1 ; i < 11; i++) {
|
||||
doPush(&mystack, i);
|
||||
}
|
||||
for(int i = 0; i < 9; i++) {
|
||||
doMult(&mystack);
|
||||
}
|
||||
doTop(&mystack, &val);
|
||||
printf("Final Val: %d\n", val);
|
||||
doPop(&mystack);
|
||||
|
||||
return 0;
|
||||
}
|
||||
21
01-StackMachine/testcases/tc17.c
Normal file
21
01-StackMachine/testcases/tc17.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doAdd(stackm* s)
|
||||
{
|
||||
printf("Add Ret: %d\n", smAdd(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doAdd(&mystack);
|
||||
doPush(&mystack, 10);
|
||||
doAdd(&mystack);
|
||||
return 0;
|
||||
}
|
||||
21
01-StackMachine/testcases/tc18.c
Normal file
21
01-StackMachine/testcases/tc18.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doSub(stackm* s)
|
||||
{
|
||||
printf("Sub Ret: %d\n", smSub(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doSub(&mystack);
|
||||
doPush(&mystack, 10);
|
||||
doSub(&mystack);
|
||||
return 0;
|
||||
}
|
||||
26
01-StackMachine/testcases/tc19.c
Normal file
26
01-StackMachine/testcases/tc19.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doMult(stackm* s)
|
||||
{
|
||||
printf("Mult Ret: %d\n", smMult(s));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doMult(&mystack);
|
||||
doPush(&mystack, 10);
|
||||
doMult(&mystack);
|
||||
return 0;
|
||||
}
|
||||
20
01-StackMachine/testcases/tc2.c
Normal file
20
01-StackMachine/testcases/tc2.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
30
01-StackMachine/testcases/tc20.c
Normal file
30
01-StackMachine/testcases/tc20.c
Normal file
@@ -0,0 +1,30 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doRotate(stackm *s, int d)
|
||||
{
|
||||
printf("Rotate Ret: %d\n", smRotate(s, d));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPush(&mystack, 2);
|
||||
smPrint(&mystack);
|
||||
doRotate(&mystack, 2);
|
||||
smPrint(&mystack);
|
||||
doPop(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
34
01-StackMachine/testcases/tc21.c
Normal file
34
01-StackMachine/testcases/tc21.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doRotate(stackm *s, int d)
|
||||
{
|
||||
printf("Rotate Ret: %d\n", smRotate(s, d));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 0 ; i < 10; i++) {
|
||||
doPush(&mystack, i);
|
||||
}
|
||||
smPrint(&mystack);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
doRotate(&mystack, i+1);
|
||||
smPrint(&mystack);
|
||||
}
|
||||
for(int i = 0; i < 10; i++) {
|
||||
doPop(&mystack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
31
01-StackMachine/testcases/tc22.c
Normal file
31
01-StackMachine/testcases/tc22.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doRotate(stackm *s, int d)
|
||||
{
|
||||
printf("Rotate Ret: %d\n", smRotate(s, d));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 0 ; i < 10; i++) {
|
||||
doPush(&mystack, i);
|
||||
}
|
||||
smPrint(&mystack);
|
||||
doRotate(&mystack, 100);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
doPop(&mystack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
31
01-StackMachine/testcases/tc23.c
Normal file
31
01-StackMachine/testcases/tc23.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doRotate(stackm *s, int d)
|
||||
{
|
||||
printf("Rotate Ret: %d\n", smRotate(s, d));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 0 ; i < 10; i++) {
|
||||
doPush(&mystack, i);
|
||||
}
|
||||
smPrint(&mystack);
|
||||
doRotate(&mystack, 0);
|
||||
for(int i = 0; i < 10; i++) {
|
||||
doPop(&mystack);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
42
01-StackMachine/testcases/tc24.c
Normal file
42
01-StackMachine/testcases/tc24.c
Normal file
@@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doMult(stackm* s)
|
||||
{
|
||||
printf("Mult Ret: %d\n", smMult(s));
|
||||
}
|
||||
|
||||
void doRotate(stackm *s, int d)
|
||||
{
|
||||
printf("Rotate Ret: %d\n", smRotate(s, d));
|
||||
}
|
||||
|
||||
void doTop(stackm* s, int* v)
|
||||
{
|
||||
printf("Top Ret: %d\n", smTop(s, v));
|
||||
}
|
||||
|
||||
int main() {
|
||||
int val = 0;
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 1 ; i <= 10; i++) {
|
||||
doPush(&mystack, i);
|
||||
doPush(&mystack, i);
|
||||
doMult(&mystack);
|
||||
}
|
||||
smPrint(&mystack);
|
||||
doTop(&mystack, &val);
|
||||
while(val > 25) {
|
||||
doRotate(&mystack, 10);
|
||||
doTop(&mystack, &val);
|
||||
}
|
||||
smPrint(&mystack);
|
||||
smClear(&mystack);
|
||||
return 0;
|
||||
}
|
||||
16
01-StackMachine/testcases/tc25.c
Normal file
16
01-StackMachine/testcases/tc25.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
for(int i = 0 ; i < 1000; i++) {
|
||||
smPush(&mystack, i);
|
||||
}
|
||||
smPrint(&mystack);
|
||||
for(int i = 0 ; i < 1000; i++) {
|
||||
smPop(&mystack);
|
||||
}
|
||||
smPrint(&mystack);
|
||||
return 0;
|
||||
}
|
||||
24
01-StackMachine/testcases/tc3.c
Normal file
24
01-StackMachine/testcases/tc3.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPush(&mystack, 2);
|
||||
doPush(&mystack, 3);
|
||||
doPop(&mystack);
|
||||
doPop(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
14
01-StackMachine/testcases/tc4.c
Normal file
14
01-StackMachine/testcases/tc4.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
9
01-StackMachine/testcases/tc5.c
Normal file
9
01-StackMachine/testcases/tc5.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
printf("SIZE: %d\n", smSize(&mystack));
|
||||
return 0;
|
||||
}
|
||||
25
01-StackMachine/testcases/tc6.c
Normal file
25
01-StackMachine/testcases/tc6.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPush(&mystack, 2);
|
||||
doPush(&mystack, 3);
|
||||
printf("SIZE: %d\n", smSize(&mystack));
|
||||
doPop(&mystack);
|
||||
doPop(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
36
01-StackMachine/testcases/tc7.c
Normal file
36
01-StackMachine/testcases/tc7.c
Normal file
@@ -0,0 +1,36 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
void doPop(stackm* s)
|
||||
{
|
||||
printf("Pop Ret: %d\n", smPop(s));
|
||||
}
|
||||
|
||||
void doTop(stackm* s, int* v)
|
||||
{
|
||||
printf("Top Ret: %d\n", smTop(s, v));
|
||||
}
|
||||
|
||||
int main() {
|
||||
int val = 0;
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doTop(&mystack, &val);
|
||||
printf("TOP: %d\n", val);
|
||||
doPush(&mystack, 2);
|
||||
doTop(&mystack, &val);
|
||||
printf("TOP: %d\n", val);
|
||||
doPush(&mystack, 3);
|
||||
doTop(&mystack, &val);
|
||||
printf("TOP: %d\n", val);
|
||||
doPop(&mystack);
|
||||
doPop(&mystack);
|
||||
doPop(&mystack);
|
||||
return 0;
|
||||
}
|
||||
9
01-StackMachine/testcases/tc8.c
Normal file
9
01-StackMachine/testcases/tc8.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
smClear(&mystack);
|
||||
return 0;
|
||||
}
|
||||
19
01-StackMachine/testcases/tc9.c
Normal file
19
01-StackMachine/testcases/tc9.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include "stackm.h"
|
||||
|
||||
void doPush(stackm* s, int v)
|
||||
{
|
||||
printf("Push Ret: %d\n", smPush(s, v));
|
||||
}
|
||||
|
||||
int main() {
|
||||
stackm mystack;
|
||||
smInit(&mystack);
|
||||
doPush(&mystack, 1);
|
||||
doPush(&mystack, 2);
|
||||
doPush(&mystack, 3);
|
||||
printf("SIZE: %d\n", smSize(&mystack));
|
||||
smClear(&mystack);
|
||||
printf("SIZE: %d\n", smSize(&mystack));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user