Hello, im being asked to create a user defined array. Ive gotten that code down, but im having trouble defining the array within a call function. If anyone knows how to properly code an array within a call function that would be appreciated.
int smallest_element(int array[], int size) {
int value = array[0];
for (i = 1; i < size; ++i) {
if (value > array[i])
value = array[i];
}
return value;
}
int main(){
//...
int smallest = smallest_element(arr, n);
std::cout << "Smallest Element = " << smallest << '\n';
}
¿what are you trying to do that is giving you issues?
misread that...
calling the size? What does it mean?
its just how many locations the array has, or how many are in use, depending on what you are talking about. If 10 locations are in use, its 10.
yeah my terminology with c++ is trash. Still new to the language and how to correctly get my point across. Anyways I got my code to run the way I needed it to.