Code:
#include<stdio.h>
double marks [20][2];
double averageMark (double marks[20][2], int numMarks);
#define LIMIT 100
void main()
{
int i=0;
int count=0;
double marks[20][2];
int numMarks;
double average;
printf("\nPlease enter the mark (-ive to end entry): ");
scanf("%lf", &marks[i][0]);
if (marks[i][0] > LIMIT)
{
printf("\nPlease enter only numbers between 0 and 100");
printf("\nPlease enter the mark (-ive to end entry): ");
scanf("%lf", &marks[i][0]);
}
while (i < 20 && marks[i][0] >= 0)
{
i++;
printf("\nPlease enter the mark (-ive to end entry): ");
scanf("%lf", &marks[i][0]);
if (marks[i][0] > LIMIT)
{
printf("\nPlease enter only numbers between 0 and 100");
printf("\nPlease enter the mark (-ive to end entry): ");
scanf("%lf", &marks[i][0]);
}
}
count = i;
i--;
numMarks = count;
printf("\nYou've entered %d marks", numMarks);
average = averageMark (marks, numMarks);
getchar();
}
double averageMark (double marks[][1],int num)
{
double totalofmarks = 0.0;
double average;
int i=0;
while (i < (num-1) || i == (num-1))
{
totalofmarks += marks[i][0];
i++;
}
return(totalofmarks/num);
}
I keep getting an error message that reads: 1>Lab7_Lab8_Arrays_Sorting.obj : error LNK2019: unresolved external symbol "double __cdecl averageMark(double (* const)[2],int)" (?averageMark@@YANQAY01NH@Z) referenced in function _main
1>C:\Users\Andrew\Documents\Visual Studio 2005\Projects\Assign_6Arrays\Debug\Assign_6Arrays. exe : fatal error LNK1120: 1 unresolved externals
Any help would be greatly appreciated...