Hi guys I am new to this forum so I am seeking to improve my programming language skill starting with C. I have subscribed to this forum to support me as a guide.
I am having a small problem printing this "Maximum Value in array" ,using gcc in Ubuntu please let me know where I can correct my mistakes and I do apologize for my English it is not my native language.
#include<stdio.h>
int max(int a[10] ,int );
int main()
{
int a[100];
int i;
int j;
printf("enter how many numbers that too be printed\n");
scanf("%d",&j);
for(i=0;i<=j-1;i++) {
scanf("%d",&a[i]);
}
printf("the original is \n");
for(i=0;i<=j-1;i++)
{
printf("%4d",a[i]);
}
printf("\n");
printf("the maximum value is %d\n",max(a,j));
return 0;
}
int max(int a[10] ,int b)
{
int mx=0;
int k;
int c=0;
for(k=1;k<=b;k++)
{
if((a[k]>a[c]) && (a[k]>mx ))
mx=a[k];
}
}
}
return (mx);
}
Compile error shows ')' missing this brackets at the end of line even though I have corrected it and even if I Ignore the results are completely different.