add Chapter06

This commit is contained in:
Amar Mahmutbegovic
2025-05-08 23:01:29 +02:00
parent 7dab196517
commit 0ea2c43f45
8 changed files with 222 additions and 0 deletions

26
Chapter06/lvalue_refs.cpp Normal file
View File

@@ -0,0 +1,26 @@
#include <cstdio>
int main() {
int a = 42;
int& a_ref = a;
const int& a_const_ref = a;
printf("a = %d\r\n", a);
a_ref = 16;
printf("a = %d\r\n", a);
// a_const_ref = 16; compiler error
return 0;
}