arret
This commit is contained in:
@@ -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'
|
||||
|
||||
|
||||
}*/
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user