C++C++11C++14C++17Learn C++

Learn to Use Constant References in C++ Functions

When we call a function with parameters taken by value, it copies the values to be made. This is a relatively inexpensive operation for fundamental types such as int, float, etc. If the parameter is composed of a large compound type, this may result in a certain overhead. For example, let’s consider this following function to combine name, mid name, and surname. string fullname (string…
Read more
C++C++11C++14C++17Introduction to C++Learn C++

Learn to Use Parameters in Functions in C++

In the C++ programming language, we can add functions with many parameters, each parameter may have different types. We can add as many parameters as we want by defining its type and its name to be used inside that function separated with ‘,’ coma. We can shape this usage in the most common syntax to define a function as below, return_type function_name ( type1 parameter1, type2…
Read more