#include <stdio.h>
int returnMax(int array[], int n){ //n is the length of the array
int max=0;
for(int i=0; i<n; i++){
if(array[i]>max){
max = array[i];
}
}
return max;
}
int main(){
int arr[]={1,2,3,45,6,7,765,3245};
int max=returnMax(arr,8);
printf("maximum element is %d",max);
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter