Commit 05d4bdb3 authored by Emil's avatar Emil
Browse files

week 3 exercises added

parent 19faf5b5
cmake_minimum_required(VERSION 2.6)
add_executable(main main.cc)
# add_executable(memory_first memory_first.cc)
# add_executable(memory_second memory_second.cc)
# add_executable(memory_third memory_third.cc)
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <fstream>
#include <iomanip>
#include <iostream>
/* -------------------------------------------------------------------------- */
int main(int argc, char ** argv){
return EXIT_SUCCESS;
}
#include <vector>
#include <array>
#include <memory>
#include <iostream>
int main() {
int values;
for (int& v : values)
v = 0;
for (int i = 0; i < 10; ++i)
std::cout << values[i] << " ";
std::cout << std::endl;
return 0;
}
#include <vector>
#include <array>
#include <memory>
#include <iostream>
std::vector<int>* stack_allocation(int n) {
return nullptr;
}
std::vector<int>* heap_allocation(int n) {
return nullptr;
}
int main() {
std::vector<int> * stack_values = stack_allocation(10);
std::vector<int> * heap_values = heap_allocation(10);
std::cout << stack_values->size() << ", " << heap_values->size() << std::endl;
return 0;
}
#include <vector>
#include <array>
#include <memory>
#include <iostream>
int main() {
auto unique = std::make_unique<std::vector<int>>(10);
std::unique_ptr<std::vector<int>> other = nullptr;
other = unique;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment