This commit is contained in:
nothke
2024-08-08 20:39:18 +02:00
commit 64be90de80
11 changed files with 726 additions and 0 deletions

9
c/malloc.c Normal file
View File

@@ -0,0 +1,9 @@
#include <stdlib.h>
int main() {
int* ptr = malloc(sizeof(int));
*ptr = 4;
free(ptr);
}

27
c/raii.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include <iostream>
#include <vector>
class MyClass
{
public:
void* ptr;
MyClass()
{
ptr = malloc(sizeof(100000000));
}
~MyClass()
{
free(ptr);
}
};
MyClass myClass;
int main()
{
std::vector<MyClass> vec;
vec.push_back({});
}

8
c/string_append_or.c Normal file
View File

@@ -0,0 +1,8 @@
#include <stdio.h>
int main() {
for (size_t i = 0; i < 5; i++)
{
printf("Number is: " + i);
}
}