federico-busato / Modern-CPP-Programming

Modern C++ Programming Course (C++03/11/14/17/20/23/26)
https://federico-busato.github.io/Modern-CPP-Programming/
11.91k stars 798 forks source link

Code fix for sizeof examples in 05.Basic_Concepts_IV #93

Closed Mati-as closed 5 months ago

Mati-as commented 5 months ago

Hello Federico

Encountered the compile error with these examples below, the page 78, on 0.5.Basic_Concept.pdf. Declaring a function parameter as 'int[] array' might seem more like a C# syntax and also require specifying the size of the array to fix compile errors (e.g. void f(const int(&array)[10])

I'm uncertain if using 'int[] array' was an intentional educational choice or if it's a misunderstanding on my part. Could you please clarify this?

image

federico-busato commented 5 months ago

Hi @Mati-as, yes, this is a typo. The intention is to use f(int array[]) to show that the syntax is bug prone.