Implicit declaration of function 'revarray'

Joined
Apr 10, 2012
Messages
1
Reaction score
0
I'm having a problem figuring out what is wrong with my program. The program is supposed to let you enter numbers until you enter -1. Then the program will print out the numbers in reverse order of inputted.

The problem I have is I get an error, implicit declaration of function 'revarray' and I can't figure out how to solve it. Please help.

My code:
#include <stdio.h>
#include <stdlib.h>
#define SIZE 101

int list(int array[SIZE], int *count, int sentinel);
int print_array(int array[SIZE], int count);
int reverray(int array[SIZE], int count);

int main(void){
int array[SIZE];
int count;
int *countptr = &count;


list(array, countptr, -1);
if(count>0){
revarray(array, count);
}
return 0;
}

int list(int array[SIZE], int *count, int sentinel){
int temp;
int i = 0;

while(temp != sentinel){
*count = i;
printf("Enter integer [%d to terminate] : ", sentinel);
scanf("%d", &temp);

if(temp == sentinel && i == 0){
printf("Error: no data input.\n");
return 1;
}else{
if(temp == sentinel){
break;
}else{
if(i==SIZE){
printf("Error: size of input is too large.\n");
return 1;
}else{
array[i++] = temp;
}
}
}
//i++;
}
}


int revarray( int array[SIZE], int count){
count = count - 1;
while(count>=0){
printf("%d\n", array[count]);
count--;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top