Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <array>
- class Array
- {
- public:
- Array(int size)
- {
- m_Data = (int*)alloca(size * sizeof(int));
- }
- private:
- int* m_Data;
- };
- int main()
- {
- //int size = 5;
- //int array[5]; // allocated on stack, can't set to int array[size] since has to be a constant value
- //int* heapArray = new int[size]; // allocated on heap
- //delete[] heapArray;
- int size = 5;
- Array data(size);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement