Cant figure out why its not giving the output as max value of the Array

#include
using namespace std;
void maximum1 (int arr1[],int N){
int maxvalue1 = arr1[0];
for(int i=1;i<N;++i){
if(arr1[i]>maxvalue1){
maxvalue1=arr1[i];
}
}
cout<<maxvalue1<<endl;
}
int main() {
int N;
cin>>N;
int arr[100];
for(int i=0;i<N;i++){
cin>>arr[i];
}
maximum1(arr,N);

return 0;

}

Hello @sahil112324,

Size of array.
Why do you think that there would not be more than 100 elements in the array?
Solution:
int arr[N];

Hope, this would help.
Give a like, if you are satisfied.

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.