can any body help me with this code ..i want to take an array from the user and get the largest element from the array and print it ..but it always gives me zero
Code:#include<stdio.h> int a[100],i,m; int max(int a[]) { for(int j=0;j<=5;j++) { m=a[i]; if(a[i+1]>a[i]) m=a[i+1]; } return m; } void main() { printf("enter the array please \n"); for(i=0;i<=5;i++) scanf("%d",&a[i]); printf("the max = %d",max(a) ); }