It can stop the function when it’s no longer needed to keep running
And it can give a certain value to send back so it can be used elsewhere in your code
Answer:
#include <iostream>
using namespace std;
void findDuplicate(int arr[], int size) {
for(int i = 0; i < size; ++i) {
for(int j = i+1; j < size; ++j) {
if(arr[j] == arr[i]) {
cout << arr[j] << endl;
return;
}
}
}
cout << -1 << endl;
}
int main() {
int arr[] = {2, 3, 5, 6, 11, 20, 4, 8, 4, 9};
findDuplicate(arr, 20);
return 0;
}
Explanation:
Answer:
Wouldn't it be false?
Explanation:
because what if the website doesn't allow some kinds of people on certain pages?
(If its wrong then sorry.)