This commit is contained in:
2026-02-02 04:52:09 +01:00
parent fca4d20f5a
commit 49213b1343
6 changed files with 64 additions and 54 deletions
+10 -9
View File
@@ -14,17 +14,21 @@ char most_frequent(const char *str){
//temp lettre
//index
//index_clc
if (str == NULL) return '\0';
char *cha = malloc(2 * sizeof(char));
//{ lettre, temp}
if (cha == NULL) return 0;
if (cha == NULL) return '\0';
*cha = 0; // lettre
*(cha + 1) = 0; //lettre pendant le clc
int *values = malloc (4 * sizeof(int));
if(values == NULL) return 0 ;
if(values == NULL) {
free(cha);
return '\0' ;
}
//{ max, temp max, index, index_clc}
*values = 0; // Maximum
@@ -60,7 +64,7 @@ char most_frequent(const char *str){
free(values);
return *cha;
}
/*
int main () {
char test = most_frequent("WRYYYY!1!"); // 'Y'
@@ -68,9 +72,6 @@ int main () {
test = most_frequent("ORA ORA ORA!"); // 'O'
printf("%c\n",test);
test = most_frequent("hello warudo!"); // 'l'
test = most_frequent('\0'); // 'l'
printf("%c\n", test);
most_frequent("oRA ora oRa?"); // 'o'
}*/
}