Thejon
2012-10-15 12:06:15 UTC
I get the following error, (on myntablet programming app):
Compile error
prog.c: In function main:
prog.c:27: error: static declaration of maxValue follows non-static declaration
prog.c:8: error: previous declaration of maxValue was here
Tried to add some comments in the code, some parts are not in use
My code for now is:
#include
#define SIZE 5
int main(void) {
// Header
int maxValue( int *,const int );
int minValue( int *,const int ); // not in use yet
double average( int[], const int ); // not in use yet
// Main
const int size= 5;
int array[SIZE] = { 6, 2, 13, 9, 5 };
int *arrayPtr = array;
int testMaxValue; // testMinValue, testAverage; Not in use yet
testMaxValue = maxValue( arrayPtr, size); // function call
printf( "The max value is %d", testMaxValue );
// Functions
int maxValue( int *arrayFunction, const int SIZEFUNK){
int i; // counter for-loop
int result = 0; // Stores the temp max value
for( i = 0; i < SIZEFUNK; i++ ){
if( arrayFunction[i] > result ){
result = arrayFunction[i];
} // end if
} // end for
return result;
} // end function maxValue
/* int minValue( int*,const int ){
} */
/* double average( int[], const int ){
} */
return 0;
}