This repository has been archived on 2026-05-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
prog-103-p-02-2030/Digby_Real_Estate/Fundamentals/my_weirddup.c
T
2026-01-29 18:42:21 +01:00

51 lines
807 B
C

#include <stdlib.h>
#include <stdio.h>
char *my_weirddup(char *src){
if(src == NULL) return NULL;
int index = 0;
while(*(src)){
index ++;
src ++;
}
char *str = malloc(index + 1);
if(str == NULL) return NULL;
//src = 0;
char lettre = ' ';
index = 0;
while (*src){
lettre = *src;
//maj
if (lettre > 64 && lettre < 91){
if (lettre == 'Z') lettre = 'A';
else lettre += 1;
}
//min
else if (lettre > 97 && lettre < 124 ){
if (lettre == 'z')lettre = 'a';
else lettre += 1;
}
*str = lettre;
src ++;
str ++;
}
return str;
}
int main(){
printf("%s",my_weirddup("abb"));
}