Hi ive been having some trouble with this program i have searched the forum and seen people making suggestion for this similar program however no of these suggestions work im almost finished with this and have a few errors that need correcting im currently using Microsoft Visual Studio 2010. here what i got Code:
#include <stdio.h>
#define N 10
int max_min(int b[], int n, int *max, int *min)
int main(void)
{
int a[N], i , big, small;
printf("Enter %d numbers: \n", N);
for( i = 0, i < N; i++; )
scanf("%d", &a[i]);
max_min(a, N, &big, &small);
printf("Largest Number %d", big);
printf("Smallest Number %d", small);
return 0;
}
int max_min(int b[], int n, int *max, int *min)
{
int i;
*max = *min = b[0];
for( i = 1; i < n; i++ )
{
if(b[i] > *max){
*max = b[i];
}
else if(b[i] < *min)
*min = b[i];
}
}
prat.c
here are my errors:
1>c:\microsoft visual studio 2010\projects\we\we\pratice.c(8): error C2085: 'main' : not in formal parameter list
1>c:\microsoft visual studio 2010\projects\we\we\pratice.c(8): error C2143: syntax error : missing ';' before '{'
1>c:\microsoft visual studio 2010\projects\we\we\pratice.c(25): error C2084: function 'int max_min(int *,int,int *,int *)' already has a body
1>c:\microsoft visual studio 2010\projects\we\we\pratice.c(5) : see previous definition of 'max_min'