From a73346181ad8c7768aa99b430ee834be58850e4e Mon Sep 17 00:00:00 2001 From: Anton Kerekesha Date: Tue, 28 Dec 2021 14:13:38 +0200 Subject: [PATCH 1/2] Done. First task --- .gitignore | 1 + .../CMakeLists.txt | 7 + 1_constants_variables_and_types/main.cpp | 395 ++++++++++++++++++ 1_some_title/CMakeLists.txt | 0 2_another_title/CMakeLists.txt | 0 CMakeLists.txt | 2 +- README.md | 4 +- 7 files changed, 407 insertions(+), 2 deletions(-) create mode 100644 1_constants_variables_and_types/CMakeLists.txt create mode 100644 1_constants_variables_and_types/main.cpp delete mode 100644 1_some_title/CMakeLists.txt delete mode 100644 2_another_title/CMakeLists.txt diff --git a/.gitignore b/.gitignore index 378eac2..5acb669 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build +.vscode diff --git a/1_constants_variables_and_types/CMakeLists.txt b/1_constants_variables_and_types/CMakeLists.txt new file mode 100644 index 0000000..22ef3d4 --- /dev/null +++ b/1_constants_variables_and_types/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.10) + +project(cvt) + +add_compile_options(-Wall -Wextra -pedantic -Werror) + +add_executable(cvt main.cpp) diff --git a/1_constants_variables_and_types/main.cpp b/1_constants_variables_and_types/main.cpp new file mode 100644 index 0000000..f1913fd --- /dev/null +++ b/1_constants_variables_and_types/main.cpp @@ -0,0 +1,395 @@ +#include + +using namespace std; + +int iglob; +static int isglob; +const int icglob{123}; +const static int icsglob{234}; +auto aglob{345}; + +double dglob; +static double dsglob; +const double dcglob{12.3}; +const static double dcsglob{23.4}; +auto adglob{34.5}; + +// The function doesn't work because global variables sent with copy of value +// template inline void print_vars(string name, T var, T * pvar, T & rvar) +// { +// cout << "Value of " << name << ": " << var << endl; +// cout << "Address of " << name << ": " << &var << endl; +// cout << "Value of p" << name << ": " << pvar << endl; +// cout << "Value of p" << name << "+1: " << pvar+1 << endl; +// cout << "Address of p" << name << ": " << &pvar << endl; +// cout << "Value of variable with address p" << name << ": " << *pvar << endl; +// cout << "Size of " << name << ": " << sizeof(var) << endl; +// cout << "Size of p" << name << ": " << sizeof(pvar) << endl; +// cout << "Size of r" << name << ": " << sizeof(rvar) << endl; +// cout << "Address of r" << name << ": " << &rvar << endl; +// cout << "Value of r" << name << ": " << rvar << endl; +// } + + +int main() +{ + + int iloc; + static int isloc; + const int icloc{654}; + const static int icsloc{876}; + + int * piglob = &iglob; + int * pisglob = &isglob; + const int * picglob = &icglob; + const int * picsglob = &icsglob; + auto *paglob=&aglob; + + + int &riglob = iglob; + int &risglob = isglob; + const int &ricglob = icglob; + const int &ricsglob = icsglob; + auto &raglob=aglob; + + int * piloc = &iloc; + int * pisloc = &isloc; + const int * picloc = &icloc; + const int * picsloc = &icsloc; + + int &riloc = iloc; + int &risloc = isloc; + const int &ricloc = icloc; + const int &ricsloc = icsloc; + + double * pdglob = &dglob; + double * pdsglob = &dsglob; + const double * pdcglob = &dcglob; + const double * pdcsglob = &dcsglob; + + double &rdglob = dglob; + double &rdsglob = dsglob; + const double &rdcglob = dcglob; + const double &rdcsglob = dcsglob; + + cout << "Hello automotive basecamp!" << endl ; + cout << "1_constants_variables_and_type" << endl ; + cout << "a - auto" << endl; + cout << "p - pointer" << endl; + cout << "r - reference" << endl; + cout << "d - double" << endl; + cout << "i - integer" << endl; + cout << "c - const" << endl; + cout << "s - static" << endl; + cout << "glob - global" << endl; + cout << "loc - local" << endl << endl; + + cout << "---------------------------------------------------------------------" << endl; + + cout << "Value of iglob: " << iglob << endl; + cout << "Address of iglob: " << &iglob << endl; + cout << "Value of piglob: " << piglob << endl; + cout << "Value of piglob+1: " << piglob+1 << endl; + cout << "Address of piglob: " << &piglob << endl; + cout << "Value of variable with address piglob: " << *piglob << endl; + cout << "Size of iglob: " << sizeof(iglob) << endl; + cout << "Size of piglob: " << sizeof(piglob) << endl; + cout << "Size of riglob: " << sizeof(riglob) << endl; + cout << "Address of riglob: " << &riglob << endl; + cout << "Value of riglob: " << riglob << endl; + riglob=545; + cout << "The reference is changed to 545" << endl; + cout << "Value of iglob: " << iglob << endl; + cout << "Value of riglob: " << riglob << endl; + + cout << endl; + + cout << "Value of isglob: " << isglob << endl; + cout << "Address of isglob: " << &isglob << endl; + cout << "Value of pisglob: " << pisglob << endl; + cout << "Value of pisglob+1: " << pisglob+1 << endl; + cout << "Address of pisglob: " << &pisglob << endl; + cout << "Value of variable with address pisglob: " << *pisglob << endl; + cout << "Size of isglob: " << sizeof(isglob) << endl; + cout << "Size of pisglob: " << sizeof(pisglob) << endl; + cout << "Size of risglob: " << sizeof(risglob) << endl; + cout << "Address of risglob: " << &risglob << endl; + cout << "Value of risglob: " << risglob << endl; + risglob=656; + cout << "The reference is changed to 656" << endl; + cout << "Value of isglob: " << isglob << endl; + cout << "Value of risglob: " << risglob << endl; + + cout << endl; + + cout << "Value of icglob: " << icglob << endl; + cout << "Address of icglob: " << &icglob << endl; + cout << "Value of picglob: " << picglob << endl; + cout << "Value of picglob+1: " << picglob+1 << endl; + cout << "Address of picglob: " << &picglob << endl; + cout << "Value of variable with address picglob: " << *picglob << endl; + cout << "Size of icglob: " << sizeof(icglob) << endl; + cout << "Size of picglob: " << sizeof(picglob) << endl; + cout << "Size of ricglob: " << sizeof(ricglob) << endl; + cout << "Address of ricglob: " << &ricglob << endl; + cout << "Value of ricglob: " << ricglob << endl; + //ricglob=741; + cout << "The reference can't be changed because it is const" << endl; + cout << "Value of icglob: " << icglob << endl; + cout << "Value of ricglob: " << ricglob << endl; + + cout << endl; + + cout << "Value of icsglob: " << icsglob << endl; + cout << "Address of icsglob: " << &icsglob << endl; + cout << "Value of picsglob: " << picsglob << endl; + cout << "Value of picsglob+1: " << picsglob+1 << endl; + cout << "Address of picsglob: " << &picsglob << endl; + cout << "Value of variable with address picsglob: " << *picsglob << endl; + cout << "Size of icsglob: " << sizeof(icsglob) << endl; + cout << "Size of picsglob: " << sizeof(picsglob) << endl; + cout << "Size of ricsglob: " << sizeof(ricsglob) << endl; + cout << "Address of ricsglob: " << &ricsglob << endl; + cout << "Value of ricsglob: " << ricsglob << endl; + //ricglob=852; + cout << "The reference can't be changed because it is const" << endl; + cout << "Value of icsglob: " << icsglob << endl; + cout << "Value of ricsglob: " << ricsglob << endl; + + cout << endl; + + cout << "Value of aglob: " << aglob << endl; + cout << "Address of aglob: " << &aglob << endl; + cout << "Value of paglob: " << paglob << endl; + cout << "Value of paglob+1: " << paglob+1 << endl; + cout << "Address of paglob: " << &paglob << endl; + cout << "Value of variable with address paglob: " << *paglob << endl; + cout << "Size of aglob: " << sizeof(aglob) << endl; + cout << "Size of paglob: " << sizeof(paglob) << endl; + cout << "Size of raglob: " << sizeof(raglob) << endl; + cout << "Address of raglob: " << &raglob << endl; + cout << "Value of raglob: " << raglob << endl; + cout << "Type of auto variable is - " << typeid(aglob).name() << endl; + cout << "Type of auto pointer is - " << typeid(paglob).name() << endl; + cout << "Type of auto reference is - " << typeid(raglob).name() << endl; + raglob=963; + cout << "The reference is changed to 963" << endl; + cout << "Value of isglob: " << aglob << endl; + cout << "Value of risglob: " << raglob << endl; + + cout << endl; + + cout << "---------------------------------------------------------------------" << endl; + cout << "Value of iloc: " << iloc << endl; + cout << "Address of iloc: " << &iloc << endl; + cout << "Value of piloc: " << piloc << endl; + cout << "Value of piloc+1: " << piloc+1 << endl; + cout << "Address of piloc: " << &piloc << endl; + cout << "Value of variable with address piloc: " << *piloc << endl; + cout << "Size of iloc: " << sizeof(iloc) << endl; + cout << "Size of piloc: " << sizeof(piloc) << endl; + cout << "Size of riloc: " << sizeof(riloc) << endl; + cout << "Address of riloc: " << &riloc << endl; + cout << "Value of riloc: " << riloc << endl; + + cout << endl; + + cout << "Value of isloc: " << isloc << endl; + cout << "Address of isloc: " << &isloc << endl; + cout << "Value of pisloc: " << pisloc << endl; + cout << "Value of pisloc+1: " << pisloc+1 << endl; + cout << "Address of pisloc: " << &pisloc << endl; + cout << "Value of variable with address pisloc: " << *pisloc << endl; + cout << "Size of isloc: " << sizeof(isloc) << endl; + cout << "Size of pisloc: " << sizeof(pisloc) << endl; + cout << "Size of risloc: " << sizeof(risloc) << endl; + cout << "Address of risloc: " << &risloc << endl; + cout << "Value of risloc: " << risloc << endl; + + cout << endl; + + cout << "Value of icloc: " << icloc << endl; + cout << "Address of icloc: " << &icloc << endl; + cout << "Value of picloc: " << picloc << endl; + cout << "Value of picloc+1: " << picloc+1 << endl; + cout << "Address of picloc: " << &picloc << endl; + cout << "Value of variable with address picloc: " << *picloc << endl; + cout << "Size of icloc: " << sizeof(icloc) << endl; + cout << "Size of picloc: " << sizeof(picloc) << endl; + cout << "Size of ricloc: " << sizeof(ricloc) << endl; + cout << "Address of ricloc: " << &ricloc << endl; + cout << "Value of ricloc: " << ricloc << endl; + + cout << endl; + + cout << "Value of icsloc: " << icsloc << endl; + cout << "Address of icsloc: " << &icsloc << endl; + cout << "Value of picsloc: " << picsloc << endl; + cout << "Value of picsloc+1: " << picsloc+1 << endl; + cout << "Address of picsloc: " << &picsloc << endl; + cout << "Value of variable with address picsloc: " << *picsloc << endl; + cout << "Size of icsloc: " << sizeof(icsloc) << endl; + cout << "Size of picsloc: " << sizeof(picsloc) << endl; + cout << "Size of ricsloc: " << sizeof(ricsloc) << endl; + cout << "Address of ricsloc: " << &ricsloc << endl; + cout << "Value of ricsloc: " << ricsloc << endl; + + cout << endl; + + cout << "---------------------------------------------------------------------" << endl; + + cout << "Value of dglob: " << dglob << endl; + cout << "Address of dglob: " << &dglob << endl; + cout << "Value of pdglob: " << pdglob << endl; + cout << "Value of pdglob+1: " << pdglob+1 << endl; + cout << "Address of pdglob: " << &pdglob << endl; + cout << "Value of variable with address pdglob: " << *pdglob << endl; + cout << "Size of dglob: " << sizeof(dglob) << endl; + cout << "Size of pdglob: " << sizeof(pdglob) << endl; + cout << "Size of rdglob: " << sizeof(rdglob) << endl; + cout << "Address of rdglob: " << &rdglob << endl; + cout << "Value of rdglob: " << rdglob << endl; + rdglob=545; + cout << "The reference is changed to 545" << endl; + cout << "Value of dglob: " << dglob << endl; + cout << "Value of rdglob: " << rdglob << endl; + + cout << endl; + + cout << "Value of dsglob: " << dsglob << endl; + cout << "Address of dsglob: " << &dsglob << endl; + cout << "Value of pdsglob: " << pdsglob << endl; + cout << "Value of pdsglob+1: " << pdsglob+1 << endl; + cout << "Address of pdsglob: " << &pdsglob << endl; + cout << "Value of variable with address pdsglob: " << *pdsglob << endl; + cout << "Size of dsglob: " << sizeof(dsglob) << endl; + cout << "Size of pdsglob: " << sizeof(pdsglob) << endl; + cout << "Size of rdsglob: " << sizeof(rdsglob) << endl; + cout << "Address of rdsglob: " << &rdsglob << endl; + cout << "Value of rdsglob: " << rdsglob << endl; + + cout << endl; + + cout << "Value of dcglob: " << dcglob << endl; + cout << "Address of dcglob: " << &dcglob << endl; + cout << "Value of pdcglob: " << pdcglob << endl; + cout << "Value of pdcglob+1: " << pdcglob+1 << endl; + cout << "Address of pdcglob: " << &pdcglob << endl; + cout << "Value of variable with address pdcglob: " << *pdcglob << endl; + cout << "Size of dcglob: " << sizeof(dcglob) << endl; + cout << "Size of pdcglob: " << sizeof(pdcglob) << endl; + cout << "Size of rdcglob: " << sizeof(rdcglob) << endl; + cout << "Address of rdcglob: " << &rdcglob << endl; + cout << "Value of rdcglob: " << rdcglob << endl; + + cout << endl; + + cout << "Value of dcsglob: " << dcsglob << endl; + cout << "Address of dcsglob: " << &dcsglob << endl; + cout << "Value of pdcsglob: " << pdcsglob << endl; + cout << "Value of pdcsglob+1: " << pdcsglob+1 << endl; + cout << "Address of pdcsglob: " << &pdcsglob << endl; + cout << "Value of variable with address pdcsglob: " << *pdcsglob << endl; + cout << "Size of dcsglob: " << sizeof(dcsglob) << endl; + cout << "Size of pdcsglob: " << sizeof(pdcsglob) << endl; + cout << "Size of rdcsglob: " << sizeof(rdcsglob) << endl; + cout << "Address of rdcsglob: " << &rdcsglob << endl; + cout << "Value of rdcsglob: " << rdcsglob << endl; + + cout << endl; + + cout << "---------------------------------------------------------------------" << endl; + + // print_vars("iglob", iglob, piglob, riglob); + +// - INT <- FLOAT +// - DOUBLE <- INT +// - INT <- CHAR +// - CHAR <- INT +// - UNSIGNED CHAR <- INT + + float floc{12.34}; + double dloc{12.3456}; + char cloc{'l'}; + unsigned char ucloc{'k'}; + + iloc=floc; + cout << "iloc <- 12.34" << endl << "iloc=" << iloc << endl; + cout << "-------" << endl; + dloc=iloc; + cout << "dloc <- 12" << endl << "dloc=" << dloc << endl; + cout << "-------" << endl; + iloc=cloc; + cout << "iloc <- 'k'" << endl << "iloc=" << iloc << endl; + cout << "-------" << endl; + iloc=1000; + cloc=iloc; + ucloc=iloc; + cout << "cloc <- 1000" << endl << "cloc=" << (int)cloc << endl; + cout << "ucloc <- 1000" << endl << "ucloc=" << (int)ucloc << endl; + cout << "---------------------------------------------------------------------" << endl << endl; + + unsigned char * puchar{&ucloc}; + cout << "*puchar <- ucloc " << endl << "*puchar=" << int (*puchar) << endl; + *puchar=*puchar +1; + cout << "increment *puchar " << endl << "*puchar=" << int (*puchar) << endl; + + cout << endl << "---------------------------------------------------------------------" << endl; + + auto adloc{345.567}; + + cout << "Variable adloc= " << adloc << endl; + cout << "Type of adloc is " << typeid(adloc).name() << endl; + + // To learn the most common mistakes and know how compilation errors look like try the next: + // - create two, global and local, variables with the same name; + // - change a value of a constant; + // - create a reference without assigning the value; + // - passing the address of a variable of a specific type to a pointer of a different type; + // - print a value of nullable pointer; + // - pass some value (for example, 0, 1, 2 ... whatever) to the pointer; + // - pass a value to a variable of a different type (for example, pass "some_string" to int variable). + + cout << endl << "---------------------------------------------------------------------" << endl; + + cout << "Global iglob befor definition of local variable = " << iglob << endl; + int iglob{2378}; + cout << "iglob after definition 'int iglob{2378}' of local variable = " << iglob << endl; + //the compiler doesn't generate any error. Local variable just shadow the global variable + + //icglob=18; + //error: assignment of read-only variable ‘icglob’ + + //int &riglob_new; + //ERROR: ‘riglob_new’ declared as reference but not initialized + + // unsigned int * uipointer = &iglob; + //error: invalid conversion from ‘int*’ to ‘unsigned int*’ + + cout << endl << "---------------------------------------------------------------------" << endl; + + //int * npointer{nullptr}; + //There is no compilation error + // try{ + // cout << "Value of nullptr pointer = " << *npointer << endl; + // } + // catch (...){ + // cout << "Error with nullptr pointer" << endl; + // } + //ERROR: Segmentation fault + + cout << endl << "---------------------------------------------------------------------" << endl; + + //int * somepointer; + + //somepointer=56; + //cout << "somepointer value = " << somepointer << ", value from pointer = " << *somepointer << endl; + //error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive] + + cout << endl << "---------------------------------------------------------------------" << endl; + + //iglob="Some string."; + //ERROR: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] + + return 0; +} \ No newline at end of file diff --git a/1_some_title/CMakeLists.txt b/1_some_title/CMakeLists.txt deleted file mode 100644 index e69de29..0000000 diff --git a/2_another_title/CMakeLists.txt b/2_another_title/CMakeLists.txt deleted file mode 100644 index e69de29..0000000 diff --git a/CMakeLists.txt b/CMakeLists.txt index 55c0477..92475d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ project(basecamp) -add_subdirectory(1_some_title) +add_subdirectory(1_constants_variables_and_types) add_subdirectory(2_another_title) # add_subdirectory(3_...) diff --git a/README.md b/README.md index c578785..7cf1928 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ -BASECAMP FOLDER STRUCTURE +## BASECAMP FOLDER STRUCTURE + + - `1_constants_variables_and_types` - learning of behavior and memory allocation of constants, variables, types, pointers and references \ No newline at end of file From c7efbf524de3317f473194f30452fb28f8f4ce0c Mon Sep 17 00:00:00 2001 From: Anton Kerekesha Date: Wed, 12 Jan 2022 00:10:02 +0200 Subject: [PATCH 2/2] Made corrections according with the comments --- 1_constants_variables_and_types/main.cpp | 637 +++++++++++------------ 2_another_title/CMakeLists.txt | 1 + CMakeLists.txt | 2 + 3 files changed, 312 insertions(+), 328 deletions(-) create mode 100644 2_another_title/CMakeLists.txt diff --git a/1_constants_variables_and_types/main.cpp b/1_constants_variables_and_types/main.cpp index f1913fd..b5af414 100644 --- a/1_constants_variables_and_types/main.cpp +++ b/1_constants_variables_and_types/main.cpp @@ -1,345 +1,324 @@ #include -using namespace std; - -int iglob; -static int isglob; -const int icglob{123}; -const static int icsglob{234}; -auto aglob{345}; - -double dglob; -static double dsglob; -const double dcglob{12.3}; -const static double dcsglob{23.4}; -auto adglob{34.5}; - -// The function doesn't work because global variables sent with copy of value -// template inline void print_vars(string name, T var, T * pvar, T & rvar) -// { -// cout << "Value of " << name << ": " << var << endl; -// cout << "Address of " << name << ": " << &var << endl; -// cout << "Value of p" << name << ": " << pvar << endl; -// cout << "Value of p" << name << "+1: " << pvar+1 << endl; -// cout << "Address of p" << name << ": " << &pvar << endl; -// cout << "Value of variable with address p" << name << ": " << *pvar << endl; -// cout << "Size of " << name << ": " << sizeof(var) << endl; -// cout << "Size of p" << name << ": " << sizeof(pvar) << endl; -// cout << "Size of r" << name << ": " << sizeof(rvar) << endl; -// cout << "Address of r" << name << ": " << &rvar << endl; -// cout << "Value of r" << name << ": " << rvar << endl; -// } - +bool bglob{true}; +bool * pbglob{&bglob}; +bool & rbglob{bglob}; +static bool sbglob{false}; +const bool cbglob{false}; +const bool *pcbglob{&cbglob}; +const bool &rcbglob{cbglob}; +const static bool csbglob{true}; + +char cglob{50}; +char * pcglob{&cglob}; +char & rcglob{cglob}; +static char scglob{'t'}; +const char ccglob{true}; +const char *pccglob{&ccglob}; +const char &rccglob{ccglob}; +const static char cscglob{'y'}; + +int iglob{123}; +int * piglob{&iglob}; +int & riglob{iglob}; +static int siglob{234}; +const int ciglob{345}; +const int *pciglob{&ciglob}; +const int &rciglob{iglob}; +const static int csiglob{567}; + +float fglob{1.23}; +float* pfglob{&fglob}; +float & rfglob{fglob}; +static float sfglob{12.3}; +const float cfglob{2.34}; +const float * pcfglob{&cfglob}; +const float & rcfglob{fglob}; +const static float csfglob{23.4}; + +double dglob{3.45}; +double* pdglob{&dglob}; +double & rdglob{dglob}; +static double sdglob{34.5}; +const double cdglob{4.56}; +const double * pcdglob{&cdglob}; +const double & rcdglob{dglob}; +const static double csdglob{45.6}; + +long lglob{123456789}; +long* plglob{&lglob}; +long & rlglob{lglob}; +static long slglob{987654321}; +const long clglob{456789123}; +const long * pclglob{&clglob}; +const long & rclglob{lglob}; +const static long cslglob{123789465}; + +template +void print_variable_info(const T& var, const std::string& name = "") { + std::string prefix = (name.empty()) ? "" : ("[" + name + "] "); + + std::cout << "\n"; + std::cout << prefix << "Value: " << var << "\n"; + std::cout << prefix << "Address: " << &var << "\n"; // Q: why it won't print address of var with type "char"? what is needed to do? + std::cout << prefix << "Type: " << typeid(var).name() << "\n"; + std::cout << prefix << "Sizeof: " << sizeof(var) << std::endl; +} int main() { - int iloc; - static int isloc; - const int icloc{654}; - const static int icsloc{876}; + bool bloc{true}; + bool* pbloc{&bloc}; + bool & rbloc{bloc}; + static bool sbloc{false}; + const bool cbloc{true}; + const bool *pcbloc{&cbloc}; + const bool &rcbloc{cbloc}; + const static bool csbloc{true}; + + char cloc{50}; + char* pcloc{&cloc}; + char & rcloc{cloc}; + static char scloc{'t'}; + const char ccloc{true}; + const char *pccloc{&ccloc}; + const char &rccloc{ccloc}; + const static char cscloc{'y'}; + + int iloc{123}; + int* piloc{&iloc}; + int & riloc{iloc}; + static int siloc{234}; + const int ciloc{345}; + const int *pciloc{&ciloc}; + const int &rciloc{iloc}; + const static int csiloc{567}; + + float floc{1.23}; + float* pfloc{&floc}; + float & rfloc{floc}; + static float sfloc{12.3}; + const float cfloc{2.34}; + const float * pcfloc{&cfloc}; + const float & rcfloc{floc}; + const static float csfloc{23.4}; + + double dloc{3.45}; + double* pdloc{&dloc}; + double & rdloc{dloc}; + static double sdloc{34.5}; + const double cdloc{4.56}; + const double * pcdloc{&cdloc}; + const double & rcdloc{dloc}; + const static double csdloc{45.6}; + + long lloc{123456789}; + long* plloc{&lloc}; + long & rlloc{lloc}; + static long slloc{987654321}; + const long clloc{456789123}; + const long * pclloc{&clloc}; + const long & rclloc{lloc}; + const static long cslloc{123789465}; + + print_variable_info(bglob,"bglob, bool global var"); + print_variable_info(pbglob,"pbglob, bool global pointer to bglob"); + print_variable_info(rbglob,"rbglob, bool global ref to bglob"); + + print_variable_info< bool>(cbglob,"cbglob, bool const global var"); + print_variable_info(pcbglob,"pcbglob, bool const global pointer to bglob"); + print_variable_info< bool>(rcbglob,"rcbglob, bool const global ref to bglob"); + + print_variable_info(sbglob,"sbglob, bool static global var"); + print_variable_info(csbglob,"csbglob, bool const static global var"); + + std::cout << "---------------------------------------------------------------------" << "\n" ; + + print_variable_info(cglob,"cglob, char global var"); + print_variable_info(pcglob,"pcglob, char global pointer to cglob"); + print_variable_info(rcglob,"rcglob, char global ref to cglob"); + + std::cout << "\n[cglob, char global var] Address: " <(&cglob) << "\n"; + std::cout << "[pcglob, char global pointer to cglob] Value: " <(pcglob) << "\n"; - int * piglob = &iglob; - int * pisglob = &isglob; - const int * picglob = &icglob; - const int * picsglob = &icsglob; - auto *paglob=&aglob; - + print_variable_info(ccglob,"ccglob, char const global var"); + print_variable_info(pccglob,"pccglob, char const global pointer to cglob"); + print_variable_info(rccglob,"rccglob, char const global ref to cglob"); + + std::cout << "\n[ccglob, char const global var] Address: " << static_cast(&ccglob) << "\n"; + std::cout << "[pccglob, char const global pointer to ccglob] Value: " << static_cast(pccglob) << "\n"; + + print_variable_info(scglob,"scglob, char static global var"); + print_variable_info(cscglob,"cscglob, char const static global var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(iglob,"iglob, int global var"); + print_variable_info(piglob,"piglob, int global pointer to iglob"); + print_variable_info(riglob,"riglob, int global ref to iglob"); + + print_variable_info(ciglob,"ciglob, int const global var"); + print_variable_info(pciglob,"pciglob, int const global pointer to iglob"); + print_variable_info(rciglob,"rciglob, int const global ref to iglob"); + + print_variable_info(siglob,"siglob, int static global var"); + print_variable_info(csiglob,"csiglob, int const static global var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(fglob,"fglob, float global var"); + print_variable_info(pfglob,"pfglob, float global pointer to fglob"); + print_variable_info(rfglob,"rfglob, float global ref to fglob"); + + print_variable_info(cfglob,"cfglob, float const global var"); + print_variable_info(pcfglob,"pcfglob, float const global pointer to fglob"); + print_variable_info(rcfglob,"rcfglob, float const global ref to fglob"); + + print_variable_info(sfglob,"sfglob, float static global var"); + print_variable_info(csfglob,"csfglob, float const static global var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(dglob,"dglob, double global var"); + print_variable_info(pdglob,"pdglob, double global pointer to dglob"); + print_variable_info(rdglob,"rdglob, double global ref to dglob"); + + print_variable_info(cdglob,"cdglob, double const global var"); + print_variable_info(pcdglob,"pcdglob, double const global pointer to dglob"); + print_variable_info(rcdglob,"rcdglob, double const global ref to dglob"); + + print_variable_info(sdglob,"sdglob, double static global var"); + print_variable_info(csdglob,"csdglob, double const static global var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(lglob,"lglob, long global var"); + print_variable_info(plglob,"plglob, long global pointer to lglob"); + print_variable_info(rlglob,"rlglob, long global ref to lglob"); + + print_variable_info(clglob,"clglob, long const global var"); + print_variable_info(pclglob,"pclglob, long const global pointer to lglob"); + print_variable_info(rclglob,"rclglob, long const global ref to lglob"); + + print_variable_info(slglob,"slglob, long static global var"); + print_variable_info(cslglob,"cslglob, long const static global var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + +print_variable_info(bloc,"bloc, bool local var"); + print_variable_info(pbloc,"pbloc, bool local pointer to bloc"); + print_variable_info(rbloc,"rbloc, bool local ref to bloc"); + + print_variable_info(cbloc,"cbloc, bool const local var"); + print_variable_info(pcbloc,"pcbloc, bool const local pointer to bloc"); + print_variable_info(rcbloc,"rcbloc, bool const local ref to bloc"); + + print_variable_info(sbloc,"sbloc, bool static local var"); + print_variable_info(csbloc,"csbloc, bool const static local var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(cloc,"cloc, char local var"); + print_variable_info(pcloc,"pcloc, char local pointer to cloc"); + print_variable_info(rcloc,"rcloc, char local ref to cloc"); + + std::cout << "\n[cloc, char local var] Address: " <(&cloc) << "\n"; + std::cout << "[pcloc, char local pointer to cloc] Value: " <(pcloc) << "\n"; + + print_variable_info(ccloc,"ccloc, char const local var"); + print_variable_info(pccloc,"pccloc, char const local pointer to cloc"); + print_variable_info(rccloc,"rccloc, char const local ref to cloc"); + + std::cout << "\n[ccloc, char const local var] Address: " <(&ccloc) << "\n"; + std::cout << "[pccloc, char const local pointer to cloc] Value: " <(pccloc) << "\n"; + + print_variable_info(scloc,"scloc, char static local var"); + print_variable_info(cscloc,"cscloc, char const static local var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(iloc,"iloc, int local var"); + print_variable_info(piloc,"piloc, int local pointer to iloc"); + print_variable_info(riloc,"riloc, int local ref to iloc"); + + print_variable_info(ciloc,"ciloc, int const local var"); + print_variable_info(pciloc,"pciloc, int const local pointer to iloc"); + print_variable_info(rciloc,"rciloc, int const local ref to iloc"); + + print_variable_info(siloc,"siloc, int static local var"); + print_variable_info(csiloc,"csiloc, int const static local var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(floc,"floc, float local var"); + print_variable_info(pfloc,"pfloc, float local pointer to floc"); + print_variable_info(rfloc,"rfloc, float local ref to floc"); + + print_variable_info(cfloc,"cfloc, float const local var"); + print_variable_info(pcfloc,"pcfloc, float const local pointer to floc"); + print_variable_info(rcfloc,"rcfloc, float const local ref to floc"); + + print_variable_info(sfloc,"sfloc, float static local var"); + print_variable_info(csfloc,"csfloc, float const static local var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(dloc,"dloc, double local var"); + print_variable_info(pdloc,"pdloc, double local pointer to dloc"); + print_variable_info(rdloc,"rdloc, double local ref to dloc"); + + print_variable_info(cdloc,"cdloc, double const local var"); + print_variable_info(pcdloc,"pcdloc, double const local pointer to dloc"); + print_variable_info(rcdloc,"rcdloc, double const local ref to dloc"); + + print_variable_info(sdloc,"sdloc, double static local var"); + print_variable_info(csdloc,"csdloc, double const static local var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; + + print_variable_info(lloc,"lloc, long local var"); + print_variable_info(plloc,"plloc, long local pointer to lloc"); + print_variable_info(rlloc,"rlloc, long local ref to lloc"); + + print_variable_info(clloc,"clloc, long const local var"); + print_variable_info(pclloc,"pclloc, long const local pointer to lloc"); + print_variable_info(rclloc,"rclloc, long const local ref to lloc"); + + print_variable_info(slloc,"slloc, long static local var"); + print_variable_info(cslloc,"cslloc, long const static local var"); + + std::cout << "---------------------------------------------------------------------" << "\n"; - int &riglob = iglob; - int &risglob = isglob; - const int &ricglob = icglob; - const int &ricsglob = icsglob; - auto &raglob=aglob; - - int * piloc = &iloc; - int * pisloc = &isloc; - const int * picloc = &icloc; - const int * picsloc = &icsloc; - - int &riloc = iloc; - int &risloc = isloc; - const int &ricloc = icloc; - const int &ricsloc = icsloc; - - double * pdglob = &dglob; - double * pdsglob = &dsglob; - const double * pdcglob = &dcglob; - const double * pdcsglob = &dcsglob; - - double &rdglob = dglob; - double &rdsglob = dsglob; - const double &rdcglob = dcglob; - const double &rdcsglob = dcsglob; - - cout << "Hello automotive basecamp!" << endl ; - cout << "1_constants_variables_and_type" << endl ; - cout << "a - auto" << endl; - cout << "p - pointer" << endl; - cout << "r - reference" << endl; - cout << "d - double" << endl; - cout << "i - integer" << endl; - cout << "c - const" << endl; - cout << "s - static" << endl; - cout << "glob - global" << endl; - cout << "loc - local" << endl << endl; - - cout << "---------------------------------------------------------------------" << endl; - - cout << "Value of iglob: " << iglob << endl; - cout << "Address of iglob: " << &iglob << endl; - cout << "Value of piglob: " << piglob << endl; - cout << "Value of piglob+1: " << piglob+1 << endl; - cout << "Address of piglob: " << &piglob << endl; - cout << "Value of variable with address piglob: " << *piglob << endl; - cout << "Size of iglob: " << sizeof(iglob) << endl; - cout << "Size of piglob: " << sizeof(piglob) << endl; - cout << "Size of riglob: " << sizeof(riglob) << endl; - cout << "Address of riglob: " << &riglob << endl; - cout << "Value of riglob: " << riglob << endl; - riglob=545; - cout << "The reference is changed to 545" << endl; - cout << "Value of iglob: " << iglob << endl; - cout << "Value of riglob: " << riglob << endl; - - cout << endl; - - cout << "Value of isglob: " << isglob << endl; - cout << "Address of isglob: " << &isglob << endl; - cout << "Value of pisglob: " << pisglob << endl; - cout << "Value of pisglob+1: " << pisglob+1 << endl; - cout << "Address of pisglob: " << &pisglob << endl; - cout << "Value of variable with address pisglob: " << *pisglob << endl; - cout << "Size of isglob: " << sizeof(isglob) << endl; - cout << "Size of pisglob: " << sizeof(pisglob) << endl; - cout << "Size of risglob: " << sizeof(risglob) << endl; - cout << "Address of risglob: " << &risglob << endl; - cout << "Value of risglob: " << risglob << endl; - risglob=656; - cout << "The reference is changed to 656" << endl; - cout << "Value of isglob: " << isglob << endl; - cout << "Value of risglob: " << risglob << endl; - - cout << endl; - - cout << "Value of icglob: " << icglob << endl; - cout << "Address of icglob: " << &icglob << endl; - cout << "Value of picglob: " << picglob << endl; - cout << "Value of picglob+1: " << picglob+1 << endl; - cout << "Address of picglob: " << &picglob << endl; - cout << "Value of variable with address picglob: " << *picglob << endl; - cout << "Size of icglob: " << sizeof(icglob) << endl; - cout << "Size of picglob: " << sizeof(picglob) << endl; - cout << "Size of ricglob: " << sizeof(ricglob) << endl; - cout << "Address of ricglob: " << &ricglob << endl; - cout << "Value of ricglob: " << ricglob << endl; - //ricglob=741; - cout << "The reference can't be changed because it is const" << endl; - cout << "Value of icglob: " << icglob << endl; - cout << "Value of ricglob: " << ricglob << endl; - - cout << endl; - - cout << "Value of icsglob: " << icsglob << endl; - cout << "Address of icsglob: " << &icsglob << endl; - cout << "Value of picsglob: " << picsglob << endl; - cout << "Value of picsglob+1: " << picsglob+1 << endl; - cout << "Address of picsglob: " << &picsglob << endl; - cout << "Value of variable with address picsglob: " << *picsglob << endl; - cout << "Size of icsglob: " << sizeof(icsglob) << endl; - cout << "Size of picsglob: " << sizeof(picsglob) << endl; - cout << "Size of ricsglob: " << sizeof(ricsglob) << endl; - cout << "Address of ricsglob: " << &ricsglob << endl; - cout << "Value of ricsglob: " << ricsglob << endl; - //ricglob=852; - cout << "The reference can't be changed because it is const" << endl; - cout << "Value of icsglob: " << icsglob << endl; - cout << "Value of ricsglob: " << ricsglob << endl; - - cout << endl; - - cout << "Value of aglob: " << aglob << endl; - cout << "Address of aglob: " << &aglob << endl; - cout << "Value of paglob: " << paglob << endl; - cout << "Value of paglob+1: " << paglob+1 << endl; - cout << "Address of paglob: " << &paglob << endl; - cout << "Value of variable with address paglob: " << *paglob << endl; - cout << "Size of aglob: " << sizeof(aglob) << endl; - cout << "Size of paglob: " << sizeof(paglob) << endl; - cout << "Size of raglob: " << sizeof(raglob) << endl; - cout << "Address of raglob: " << &raglob << endl; - cout << "Value of raglob: " << raglob << endl; - cout << "Type of auto variable is - " << typeid(aglob).name() << endl; - cout << "Type of auto pointer is - " << typeid(paglob).name() << endl; - cout << "Type of auto reference is - " << typeid(raglob).name() << endl; - raglob=963; - cout << "The reference is changed to 963" << endl; - cout << "Value of isglob: " << aglob << endl; - cout << "Value of risglob: " << raglob << endl; - - cout << endl; - - cout << "---------------------------------------------------------------------" << endl; - cout << "Value of iloc: " << iloc << endl; - cout << "Address of iloc: " << &iloc << endl; - cout << "Value of piloc: " << piloc << endl; - cout << "Value of piloc+1: " << piloc+1 << endl; - cout << "Address of piloc: " << &piloc << endl; - cout << "Value of variable with address piloc: " << *piloc << endl; - cout << "Size of iloc: " << sizeof(iloc) << endl; - cout << "Size of piloc: " << sizeof(piloc) << endl; - cout << "Size of riloc: " << sizeof(riloc) << endl; - cout << "Address of riloc: " << &riloc << endl; - cout << "Value of riloc: " << riloc << endl; - - cout << endl; - - cout << "Value of isloc: " << isloc << endl; - cout << "Address of isloc: " << &isloc << endl; - cout << "Value of pisloc: " << pisloc << endl; - cout << "Value of pisloc+1: " << pisloc+1 << endl; - cout << "Address of pisloc: " << &pisloc << endl; - cout << "Value of variable with address pisloc: " << *pisloc << endl; - cout << "Size of isloc: " << sizeof(isloc) << endl; - cout << "Size of pisloc: " << sizeof(pisloc) << endl; - cout << "Size of risloc: " << sizeof(risloc) << endl; - cout << "Address of risloc: " << &risloc << endl; - cout << "Value of risloc: " << risloc << endl; - - cout << endl; - - cout << "Value of icloc: " << icloc << endl; - cout << "Address of icloc: " << &icloc << endl; - cout << "Value of picloc: " << picloc << endl; - cout << "Value of picloc+1: " << picloc+1 << endl; - cout << "Address of picloc: " << &picloc << endl; - cout << "Value of variable with address picloc: " << *picloc << endl; - cout << "Size of icloc: " << sizeof(icloc) << endl; - cout << "Size of picloc: " << sizeof(picloc) << endl; - cout << "Size of ricloc: " << sizeof(ricloc) << endl; - cout << "Address of ricloc: " << &ricloc << endl; - cout << "Value of ricloc: " << ricloc << endl; - - cout << endl; - - cout << "Value of icsloc: " << icsloc << endl; - cout << "Address of icsloc: " << &icsloc << endl; - cout << "Value of picsloc: " << picsloc << endl; - cout << "Value of picsloc+1: " << picsloc+1 << endl; - cout << "Address of picsloc: " << &picsloc << endl; - cout << "Value of variable with address picsloc: " << *picsloc << endl; - cout << "Size of icsloc: " << sizeof(icsloc) << endl; - cout << "Size of picsloc: " << sizeof(picsloc) << endl; - cout << "Size of ricsloc: " << sizeof(ricsloc) << endl; - cout << "Address of ricsloc: " << &ricsloc << endl; - cout << "Value of ricsloc: " << ricsloc << endl; - - cout << endl; - - cout << "---------------------------------------------------------------------" << endl; - - cout << "Value of dglob: " << dglob << endl; - cout << "Address of dglob: " << &dglob << endl; - cout << "Value of pdglob: " << pdglob << endl; - cout << "Value of pdglob+1: " << pdglob+1 << endl; - cout << "Address of pdglob: " << &pdglob << endl; - cout << "Value of variable with address pdglob: " << *pdglob << endl; - cout << "Size of dglob: " << sizeof(dglob) << endl; - cout << "Size of pdglob: " << sizeof(pdglob) << endl; - cout << "Size of rdglob: " << sizeof(rdglob) << endl; - cout << "Address of rdglob: " << &rdglob << endl; - cout << "Value of rdglob: " << rdglob << endl; - rdglob=545; - cout << "The reference is changed to 545" << endl; - cout << "Value of dglob: " << dglob << endl; - cout << "Value of rdglob: " << rdglob << endl; - - cout << endl; - - cout << "Value of dsglob: " << dsglob << endl; - cout << "Address of dsglob: " << &dsglob << endl; - cout << "Value of pdsglob: " << pdsglob << endl; - cout << "Value of pdsglob+1: " << pdsglob+1 << endl; - cout << "Address of pdsglob: " << &pdsglob << endl; - cout << "Value of variable with address pdsglob: " << *pdsglob << endl; - cout << "Size of dsglob: " << sizeof(dsglob) << endl; - cout << "Size of pdsglob: " << sizeof(pdsglob) << endl; - cout << "Size of rdsglob: " << sizeof(rdsglob) << endl; - cout << "Address of rdsglob: " << &rdsglob << endl; - cout << "Value of rdsglob: " << rdsglob << endl; - - cout << endl; - - cout << "Value of dcglob: " << dcglob << endl; - cout << "Address of dcglob: " << &dcglob << endl; - cout << "Value of pdcglob: " << pdcglob << endl; - cout << "Value of pdcglob+1: " << pdcglob+1 << endl; - cout << "Address of pdcglob: " << &pdcglob << endl; - cout << "Value of variable with address pdcglob: " << *pdcglob << endl; - cout << "Size of dcglob: " << sizeof(dcglob) << endl; - cout << "Size of pdcglob: " << sizeof(pdcglob) << endl; - cout << "Size of rdcglob: " << sizeof(rdcglob) << endl; - cout << "Address of rdcglob: " << &rdcglob << endl; - cout << "Value of rdcglob: " << rdcglob << endl; - - cout << endl; - - cout << "Value of dcsglob: " << dcsglob << endl; - cout << "Address of dcsglob: " << &dcsglob << endl; - cout << "Value of pdcsglob: " << pdcsglob << endl; - cout << "Value of pdcsglob+1: " << pdcsglob+1 << endl; - cout << "Address of pdcsglob: " << &pdcsglob << endl; - cout << "Value of variable with address pdcsglob: " << *pdcsglob << endl; - cout << "Size of dcsglob: " << sizeof(dcsglob) << endl; - cout << "Size of pdcsglob: " << sizeof(pdcsglob) << endl; - cout << "Size of rdcsglob: " << sizeof(rdcsglob) << endl; - cout << "Address of rdcsglob: " << &rdcsglob << endl; - cout << "Value of rdcsglob: " << rdcsglob << endl; - - cout << endl; - - cout << "---------------------------------------------------------------------" << endl; - - // print_vars("iglob", iglob, piglob, riglob); - -// - INT <- FLOAT -// - DOUBLE <- INT -// - INT <- CHAR -// - CHAR <- INT -// - UNSIGNED CHAR <- INT - - float floc{12.34}; - double dloc{12.3456}; - char cloc{'l'}; unsigned char ucloc{'k'}; iloc=floc; - cout << "iloc <- 12.34" << endl << "iloc=" << iloc << endl; - cout << "-------" << endl; + std::cout << "iloc <- 12.34\n" << "iloc=" << iloc << "\n"; + std::cout << "-------\n"; dloc=iloc; - cout << "dloc <- 12" << endl << "dloc=" << dloc << endl; - cout << "-------" << endl; + std::cout << "dloc <- 12\n" << "dloc=" << dloc << "\n"; + std::cout << "-------\n"; iloc=cloc; - cout << "iloc <- 'k'" << endl << "iloc=" << iloc << endl; - cout << "-------" << endl; + std::cout << "iloc <- 'k'\n" << "iloc=" << iloc << "\n"; + std::cout << "-------" << "\n"; iloc=1000; cloc=iloc; ucloc=iloc; - cout << "cloc <- 1000" << endl << "cloc=" << (int)cloc << endl; - cout << "ucloc <- 1000" << endl << "ucloc=" << (int)ucloc << endl; - cout << "---------------------------------------------------------------------" << endl << endl; + std::cout << "cloc <- 1000\n" << "cloc=" << (int)cloc << "\n"; + std::cout << "ucloc <- 1000\n" << "ucloc=" << (int)ucloc << "\n"; + std::cout << "---------------------------------------------------------------------\n\n";; unsigned char * puchar{&ucloc}; - cout << "*puchar <- ucloc " << endl << "*puchar=" << int (*puchar) << endl; + std::cout << "*puchar <- ucloc \n" << "*puchar=" << int (*puchar) << "\n"; *puchar=*puchar +1; - cout << "increment *puchar " << endl << "*puchar=" << int (*puchar) << endl; + std::cout << "increment *puchar \n" << "*puchar=" << int (*puchar) << " \nucloc=" << (int)ucloc << "\n"; - cout << endl << "---------------------------------------------------------------------" << endl; + std::cout << "---------------------------------------------------------------------\n"; auto adloc{345.567}; - cout << "Variable adloc= " << adloc << endl; - cout << "Type of adloc is " << typeid(adloc).name() << endl; + std::cout << "Variable adloc= " << adloc << "\n"; + std::cout << "Type of adloc is " << typeid(adloc).name() << "\n"; // To learn the most common mistakes and know how compilation errors look like try the next: // - create two, global and local, variables with the same name; @@ -350,11 +329,11 @@ int main() // - pass some value (for example, 0, 1, 2 ... whatever) to the pointer; // - pass a value to a variable of a different type (for example, pass "some_string" to int variable). - cout << endl << "---------------------------------------------------------------------" << endl; + std::cout << "---------------------------------------------------------------------" << std::endl; - cout << "Global iglob befor definition of local variable = " << iglob << endl; + std::cout << "Global iglob befor definition of local variable = " << iglob << "\n"; int iglob{2378}; - cout << "iglob after definition 'int iglob{2378}' of local variable = " << iglob << endl; + std::cout << "iglob after definition 'int iglob{2378}' of local variable = " << iglob << "\n"; //the compiler doesn't generate any error. Local variable just shadow the global variable //icglob=18; @@ -366,30 +345,32 @@ int main() // unsigned int * uipointer = &iglob; //error: invalid conversion from ‘int*’ to ‘unsigned int*’ - cout << endl << "---------------------------------------------------------------------" << endl; + //std::cout << endl << "---------------------------------------------------------------------" << endl; //int * npointer{nullptr}; //There is no compilation error // try{ - // cout << "Value of nullptr pointer = " << *npointer << endl; + // std::cout << "Value of nullptr pointer = " << *npointer << endl; // } // catch (...){ - // cout << "Error with nullptr pointer" << endl; + // std::cout << "Error with nullptr pointer" << endl; // } //ERROR: Segmentation fault - cout << endl << "---------------------------------------------------------------------" << endl; + //std::cout << endl << "---------------------------------------------------------------------" << endl; //int * somepointer; //somepointer=56; - //cout << "somepointer value = " << somepointer << ", value from pointer = " << *somepointer << endl; + //std::cout << "somepointer value = " << somepointer << ", value from pointer = " << *somepointer << endl; //error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive] - cout << endl << "---------------------------------------------------------------------" << endl; + ///std::cout << endl << "---------------------------------------------------------------------" << endl; //iglob="Some string."; //ERROR: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive] + + std::cout << std::endl; return 0; } \ No newline at end of file diff --git a/2_another_title/CMakeLists.txt b/2_another_title/CMakeLists.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/2_another_title/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/CMakeLists.txt b/CMakeLists.txt index 92475d3..3e06409 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION 3.10) + project(basecamp) add_subdirectory(1_constants_variables_and_types)