This commit is contained in:
2026-02-02 03:36:21 +01:00
parent 2ae8d93f16
commit 6841949095
7 changed files with 365 additions and 23 deletions
+32 -23
View File
@@ -6,45 +6,54 @@ char *my_weirddup(char *src){
if(src == NULL) return NULL;
int index = 0;
while(*(src)){
while(*(src + index)){
index ++;
src ++;
}
char *str = malloc(index + 1);
char *str = malloc(index);
if(str == NULL) return NULL;
//src = 0;
//printf("test");
char lettre = ' ';
index = 0;
while (*src){
lettre = *src;
//maj
while (*(src + index) != '\0'){
lettre = *(src + index);
//MAJ
if (lettre > 64 && lettre < 91){
if (lettre == 'Z') lettre = 'A';
else lettre += 1;
else lettre ++;
}
//min
else if (lettre > 97 && lettre < 124 ){
if (lettre == 'z')lettre = 'a';
else lettre += 1;
if (lettre > 96 && lettre < 124) {
if (lettre == 'z') lettre = 'a';
else lettre ++;
}
*str = lettre;
src ++;
str ++;
*(str + index) = lettre;
index ++;
}
*(str + index + 1) = '\0';
return str;
}
int main(){
printf("%s",my_weirddup("abb"));
}
//TODO MARCHE MAIS À COMPLETER
int main(int args ,char **arg){
int index = 1;
char *rslt = "";
while(index < args){
rslt = my_weirddup(*(arg + index));
printf("%s\n",rslt);
free(rslt);
index ++;
}
}