Pointers and arrays
The concept of array is very much bound to the one of pointer.
Pointers and arrays
The concept of array is very much bound to the one of pointer.
Notice that even though we have never directly set a value to either firstvalue or secondvalue, both end up with a value set indirectly through the use of mypointer.
Declaring variables of pointer types
Due to the ability of a pointer to directly refer to the value that it points to, it becomes necessary to specify in its declaration which data type a pointer is
Using null-terminated sequences of characters
Null-terminated sequences of characters are the natural way of treating strings in C++, so they can be used as such in many procedures.
Arrays as parameters
At some moment we may need to pass an array to a function as a parameter.
Declaring functions.
Until now, we have defined all of the functions before the first appearance of calls to them in the source code.
Recursivity is the property that functions have to be called by themselves. It is useful for many tasks, like sorting or calculate the factorial of numbers.
Overloaded functions.
In C++ two different functions can have the same name if their parameter types or number are different.
Default values in parameters.
When declaring a function we can specify a default value for each of the last parameters.