Add .gitignore for IntelliJ IDEA and initial CMake configuration.

This commit is contained in:
2026-02-06 12:22:28 +01:00
commit b22b7f213f
18 changed files with 816 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
#include <iostream>
#include "functions.h"
using namespace std;
void functionB() {
}
void functionC(); // forward declaration
void functionD(); // forward declaration
int main() {
const char *lang = "C++";
std::cout << "Hello and welcome to " << lang << "!\n";
for (int i = 1; i <= 5; i++) {
std::cout << "i = " << i << std::endl;
}
// functionA(); // compiler error - function is defined after call
functionB(); // no error - function is defined before call
// functionC(); // linker error - function is declared but not defined
functionD(); // no error - function is declared and defined
functionE();
// functionF(); // linker error - function is defined twice
// byte b;
short s;
int i;
long l;
long long ll;
cout << "size of short: " << sizeof(s) << endl;
cout << "size of int: " << sizeof(i) << endl;
cout << "size of long: " << sizeof(l) << endl;
cout << "size of long long: " << sizeof(ll) << endl;
int* pI = nullptr;
pI = &i;
*pI = 10;
pI = new int;
pI = new int(); // CAUTION - memory leak created
pI = new int(10); // CAUTION - memory leak created
delete pI;
pI = nullptr;
int& rI = i; // reference
return 0;
}
void functionA() {
}
void functionD() {}