functions and arrays.check question below:

Jul 24, 2010 at 11:00am
implement a program that :
1. reads elements into an array of size n.
2. returns the minimum element and sum of all elements in array.
3. prints out the sorted array.
please check the program below for the errors and correct where possible.

#include<stdio.h>
{
/*function prototype*/
void stats(int a[],int n);
for(int i=0;i<n;i++)
}
main()
{
/*function call*/
int a[n]={'3','4','6','10'};
int s,m;
stats (a[],s,m);
swap(a[],current,pos);
printf("%d",s,m);
printf("%d",current,pos);
}
void stats(int a[n],int &min,int &sum)
{
int sum=0;
sum=sum=int a[];
if(a[n]<a[pos])
{
pos=i;
}
min=i;
return min,sum;
}
void selection sort(int a[],int n)
{
pos=position of smallest(a[],i,n)
swap(a[],curent,pos);
}
Jul 24, 2010 at 4:57pm
Why don't you let the compiler check your program for errors. You have a plethora of
compile errors to fix before worrying about whether or not it works.
Jul 26, 2010 at 10:03am
that was just my trial for the question above but it is generating a lot of errors and i don't know if it is the correct pr0ogram for question above. may be you can show me a better one to run the arrays, sort and give statistics shown above.
Topic archived. No new replies allowed.