thank you all so much

but still even when i managed to compiled

i still don't get the result i wanted....

i set min =2; max= 8

so my original array {0,1,2,3,4,5,6,7,8,9)

shd look like this when i run the function

{2,2,2,3,4,5,6,7,8,8}

but i get

{8,8,8,8,8,8,8,8} lol

can anyone please enlighten me??

thanks

Code:

#include <vcl.h>
#include <condefs.h>
#include "MT262io.h"
#define Size 10
#pragma hdrstop
void setArray(int NumberArray[10]);
void MinMaxLimit(int min, int max,int NumberArray[10]);
float Average (int NumberArray[10]);
void displayArray(int NumberArray[10]);
//---------------------------------------------------------------------------
#pragma argsused
int main(int argc, char* argv[])
{
int MyArray[10] = {0,1,2,3,4,5,6,7,8,9};
int minimum =2;
int maximum =8;
MinMaxLimit(minimum, maximum ,MyArray);
displayArray(MyArray);
WriteStringCr (Average (MyArray));
getchar(); //-- hold the screen
}
void setArray(int NumberArray[10])
{
int num[10] = {0,1,2,3,4,56,7,8,9};
setArray(num);
return;
}
void MinMaxLimit(int min, int max,int NumberArray[10])
{
int counter;
for(counter =0; counter <10; counter ++)
{
if (NumberArray[counter] < min)
{
min =min +1;
}
if (NumberArray[counter] > max )
{
max =max +1;
}
counter = counter +1;
}
}
float Average (int NumberArray[10])
{
int total;
float average;
int counter;
for(counter =0; counter <10; counter ++)
{
total = total + NumberArray[counter];
}
average = total/10;
return average;
}
void displayArray(int NumberArray[10])
{
int Index;
for (Index=0; Index<Size; Index = Index + 1)
{
WriteIntPr(" ", NumberArray[10]);
}
WriteString("\n");
return;
}