fonction 10 : O(L)

This commit is contained in:
abraham
2026-10-21 11:49:58 +02:00
parent b40a1c2081
commit 7c09526d0a
3 changed files with 11 additions and 5 deletions
+10 -4
View File
@@ -235,10 +235,16 @@ int categorie(const Transaction *t)
/* F10 : ajoute une ligne à la fin du rapport */
int longueur(const char *s)
{
int n = 0;
while (s[n] != '\0')
n++;
return n;
static const char *chaine_connue = NULL;
static int n_connu = 0;
if (s != chaine_connue || s[0] == '\0') {
chaine_connue = s;
n_connu = 0;
}
while (s[n_connu] != '\0')
n_connu++;
return n_connu;
}
void ajouter_ligne(char *rapport, const char *ligne)