//Test program
//SOAC, FACE UWTSD
//Tutor: G Dickers

// define sizes of arrays
#define SIZE1 500
#define SIZE2 1000
#define SIZE3 15000
#define SIZE4 20000
#define SIZE5 40000

//declare arrays
int testArray1[SIZE1];
int testArray2[SIZE2];
int testArray3[SIZE3];
int testArray4[SIZE4];
int testArray5[SIZE5];

//prototype functions. Functions to test
void aFunc1(int*, int);
void aFunc2(int*, int);
void aFunc3(int*, int);


void initArrays(void); //this function initialises arrays to zeros


int main(void)
//Test harness
{
	initArrays();
	//change afunc* params as described in question 1.
	aFunc1(testArray5, SIZE5);
	aFunc2(testArray5, SIZE5);
	aFunc3(testArray5, SIZE5);


	return 0;
}

void initArrays(void)
{
	//Initialize all arrays' contents to zero
	for (int j = 0; j < SIZE1; j++)
		testArray1[j] = 0;
	for (int j = 0; j < SIZE2; j++)
		testArray2[j] = 0;
	for (int j = 0; j < SIZE3; j++)
		testArray3[j] = 0;
	for (int j = 0; j < SIZE4; j++)
		testArray4[j] = 0;
	for (int j = 0; j < SIZE5; j++)
		testArray5[j] = 0;
}

void aFunc3(int* a, int n)
//for use with Q1
{
	int b, c, d, e;
	for (int i = 0; i < n; i++)
	{
		for (int k = 0; k < n; k++)
		{


			a[i] = (i + 5) % n;
			for (int j = 0; j < 10; j++)
			{
				c = 4;
				b = c + 2;
				d = b + 1;
				e = d*2 + j;
			}
		}
	}
}

void aFunc1(int* a, int n)
//for use with Q1
{
	int b, c, d, e, f;
	for (int i = 0; i < n; i++)
	{
		a[i] = (i + 2) % n;
		for (int j = 0; j < 1000; j++)
			b = c = d = e = f = j;
	}
}


void aFunc2(int* a, int n)
//for use with Q1
{
	for (int j = 0;j<SIZE1;j++)
		for (int i = 0; i<SIZE1; i++)
			a[i] = i + n%2;
}




