add Chapter02 examples

This commit is contained in:
Amar Mahmutbegovic
2024-04-27 21:02:06 +02:00
parent de6d74e093
commit 5af72efc42
6 changed files with 148 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#include <array>
#include <cstdio>
#include <cstdlib>
#include <exception>
int main() {
constexpr auto my_terminate_handler = []() {
printf("This is my_terminate_handler\r\n");
std::abort();
};
std::set_terminate(my_terminate_handler);
std::array<int, 4> arr;
for (int i = 0; i < 5; i++) {
arr.at(i) = i;
}
return 0;
}