archi124
This commit is contained in:
@@ -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 ++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user