Last active
April 24, 2017 21:06
-
-
Save lggomez/005a166b0296e0e6c79d6bec40d3ad79 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyStack<T> | |
| { | |
| readonly int m_Size; | |
| readonly T[] m_Items; | |
| int m_StackPointer = 0; | |
| public MyStack(int size) | |
| { | |
| m_Size = size; | |
| m_Items = new T[m_Size]; | |
| } | |
| public T Pop() | |
| { | |
| m_StackPointer--; | |
| return m_Items[m_StackPointer]; | |
| } | |
| public void Push(T item) | |
| { | |
| m_Items[m_StackPointer] = item; | |
| m_StackPointer++; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment