Add vectors and memory

This commit is contained in:
Lev
2021-05-26 17:02:26 -05:00
parent b7a78c7621
commit 2aa60d7c4c
2 changed files with 23 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,23 @@
#include <iostream>
#include <vector>
#include <string>
//using namespace std;
int main()
{
//vector<string> a;
std::vector<std::string> strings;
strings.push_back("one");
strings.push_back("two");
strings.push_back("three");
// we use const because we won't mutate the data in the s variable
// Because we're only reading, we don't want to create a copy
// so we use a reference '&' instead
for (const std::string& s:strings)
{
std::cout << s << std::endl;
std::string lel = "lol";
//s.append(lel); // we can't use this because s is of type const
}
}