Why can’t we pass arrays to function by value?

The origin is historical. The problem is that the rule “arrays decay into pointers, when passed to a function” is simple. Copying arrays would be kind of complicated and not very clear, since the behavior would change for different parameters and different function declarations. Note that you can still do an indirect pass by value:

C++ printing boolean, what is displayed?

The standard streams have a boolalpha flag that determines what gets displayed — when it’s false, they’ll display as 0 and 1. When it’s true, they’ll display as false and true. There’s also an std::boolalpha manipulator to set the flag, so this: …produces output like: For what it’s worth, the actual word produced when boolalpha is set to true is localized–that is, <locale> has a num_put category that handles numeric conversions, … Read more

reading from stdin in c++

You have not defined the variable input_line. Add this: And add this include. Here is the full example. I also removed the semi-colon after the while loop, and you should have getline inside the while to properly detect the end of the stream.

Learning to work with audio in C++

It really depends on what kind of audio work you want to do, If you want to implement audio for a game, C++ is sure the right language. There are many libraries around, OpenAL is great, free and multiplatform. I also used DirectSound and Fmod with great sucess. Check them out, it all depends on … Read more

term does not evaluate to a function taking 1 arguments

Problem #1: The name of the second argument and the type of the second argument are swapped somehow. It should be: Instead of: Which is what you have. Problem #2: You need to add a couple of parentheses to get the function correctly dereferenced: Eventually, this is what you get: And here is a live example of your program … Read more