I would like to understand what is the differnt between both of following calls -
Get(arr, size, find) = 13;
Get(arr, size, find);
what is mean that the function equal to 13 ?
#include <iostream>
usingnamespace std;
int & Get( int *array, int size, int find )
{
for ( int i = 0; i < size; i++ )
{
if ( array[i] == find ) return array[i];
}
return array[0];
}
int main()
{
int a[] = {1, 2, 3, 4, 5 };
for ( int e : a ) cout << e << ' ';
cout << '\n';
Get( a, 5, 3 ) = 13;for ( int e : a ) cout << e << ' ';
cout << '\n';
}