Ajouter main.c

This commit is contained in:
bastien 2025-03-17 08:50:02 +00:00
parent 00bddb7614
commit f38bf3d6d5

34
main.c Normal file
View File

@ -0,0 +1,34 @@
#include <stdio.h>
#include <stdlib.h>
int main{
// Partie A: Implémentation des fonctions de base
printf("Partie A: Fonctions de base sur les chaînes\n");
char chaine1[50] = "Bonjour";
char chaine2[50] = "Monde";
char chaine3[100];
printf("Chaine1: \"%s\"\n", chaine1);
printf("Chaine2: \"%s\"\n", chaine2);
printf("Longueur de chaine1: %d caractères\n", ma_strlen(chaine1));
ma_strcpy(chaine3, chaine1);
printf("Copie de chaine1 dans chaine3: \"%s\"\n", chaine3);
ma_strcat(chaine3, " ");
ma_strcat(chaine3, chaine2);
printf("Concaténation: \"%s\"\n\n", chaine3);
// Partie B: Allocation dynamique
printf("Partie B: Allocation dynamique\n");
char *inverse = inverser_chaine(chaine3);
printf("Chaîne inversée: \"%s\"\n", inverse);
char *voyelles = filtrer_voyelles(chaine3);
printf("Voyelles uniquement: \"%s\"\n", voyelles);
return 0;
}