> FIND_NUM() accepts 'choice' and the array
and searches for the value, and returns a value to MAIN().
The question is, what value should it return?
And what should it return if the value is not found?
The loop in main is a waste, it's just duplicating what FIND_NUM is supposed to do.
How about
Code:
int find_num( int *aptr, int found ) {
int i;
for(i = 0; i < 5; i++) {
if(aptr[i] == found)
return i; // found - result is array position
}
return -1; // not found
}
Then main just has
Code:
if ( num != -1 ) {
// found
} else {
// not found
}
Oh, and
void main(void)
should be
int main(void)