hi all i'm asked to make a function in c that returns the repeated digits when 5 values are entered by the user, i did the program but the compiler(Code Blocks in Mac) is giving me a warning saying that "Control end at non void function" , the program is assuming that i'm not returning a value to the function call . any ideas how to avoid that please and fix it ??? here is my program below:
Edited by mod: added code tags, changed variable i to variable k
Code:
#include <stdio.h>
int repeat(int fA, int fB, int fC, int fD, int fE);
int main (){
int a, b, c, d, e;
printf("Enter numbers: ");
scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
printf("\n%d\n", repeat(a, b ,c, d, e));
return 0;
}
int repeat(fA, fB, fC, fD, fE) {
int k,j, array[] = {fA, fB, fC, fD, fE};
for(k = 0; k <= 3; ++k) {
for( j = k + 1; j <= 4; ++j) {
if(array[k] == array[j]) {
return array[k];
}
}
}
}
Last edited by a moderator: