How's is this program working?

You have already mentioned one thing: The better type checking.

Another example is the range based for loop, which prevents writing beyond index bounds.

Or using references for function parameters, which helps to avoid errors with pointers.

1 Like

Could not disagree more. One can see convincing evidence around here, like “I tried a ‘for’ in my void, maybe I need an ‘if’”.

It’s like (trying to) write poetry before you even know the alphabet.

a7

1 Like

You have already mentioned one thing: The better type checking.

Another example is the range based for loop, which prevents writing beyond index bounds.

Or using references for function parameters, which helps to avoid errors with pointers.

thanks. those are reasonable examples. that last i only learned about late in my career. have no idea what the 2nd one is.

which C++ book do you recommend: for students, professionals and those learning Arduino ?

1 Like

Templates.

And you think it would be any difference with C?

1 Like

May be this will help a little bit?
E.g. you can iterate over an array, and the compiler knows its size.

That's a difficult question - there are so many. I know one in German, but I'm afraid that won't help you. :wink:

1 Like

Why yes, yes I do.

a7

1 Like

That’s a difficult question - there are so many. I know one in German, but I’m afraid that won’t help you

i've read the 1st three versions of the stroustrup book. the first was about the same size as the K&R. the last i saw was about 1.5" thick. it's quite a bit to read/learn for someone new to programming

for a student/professional learning OOP, the Go Programming Language may be better because Go is a pure OOP language developed with Ken Thompson.

without a better (in english) book recommendation, i don't think it's fair not to suggest the K&R book , especially for someone learning Arduino.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.