Ich mache Wettbewerb Codierung und auf der Website dh Hacker mein Programm gibt die "Fehlerkontrolle erreicht Ende der nicht-void-Funktion [-Werror = Rückgabetyp]" aber auf Codeblocks funktioniert gut hier ist mein Code. Fehler im Programm vor Ort, aber nicht auf Codeblocks
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
int count_max_freq(int *a,int n,int i)
{ static int max_freq=0,index;
int t=a[i],f=0;
for(int j=i;j<n;j++)
if(a[i]==a[j])
f++;
if(max_freq<f)
{ max_freq=f;
index=i;
}
if(i<n)
count_max_freq(a,n,i+1);
else
return a[index];
}
int main(){
int n;
scanf("%d",&n);
int *types = malloc(sizeof(int) * n);
for(int types_i = 0; types_i < n; types_i++){
scanf("%d",&types[types_i]);
}
// your code goes here
printf("%d",count_max_freq(types,n,0));
return 0;
}
müssen Sie das beheben: 'if (i 'if (i