Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- int size = 5;
- //Array<int, 5> data; // Version of this class where T is set to int and size set to 5
- Array<std::string, 2> data;
- data[0] = "Cherno";
- data[1] = "C++";
- // memset(data.Data(), 0, data.Size() * sizeof(int)); // Set all integers inside of our array to 0 by setting all memory to 0.
- // Not necessary, can do this the other way by taking first index of array and grab its index since the stack is contiguous in memory
- //memset(&data[0], 0, data.Size() * sizeof(int));
- data[1] = 5;
- data[4] = 8;
- for (size_t i = 0; i < data.Size(); i++) // Indexes throughout data
- {
- std::cout << data[i] << std::endl;
- }
- std::cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement