diff --git a/Digby_Real_Estate/Fundamentals/count.c b/Digby_Real_Estate/Fundamentals/count.c index e69de29..b5cef6a 100644 --- a/Digby_Real_Estate/Fundamentals/count.c +++ b/Digby_Real_Estate/Fundamentals/count.c @@ -0,0 +1,28 @@ +#include +//#include +int *count(int n){ + if (n < 1) return NULL; + int *p = malloc(n); + if(p == NULL) return NULL; + + while (n != 0){ + + *(p + n-1) = n; + n --; + } + return p; +} +/* +int main(){ + int *rslt = count(5); + int index = 0; + + while(*(rslt + index)){ + + printf("%i", *(rslt + index)); + index ++; + } + free(rslt); + +}*/ + diff --git a/Digby_Real_Estate/Fundamentals/my_weirddup.c b/Digby_Real_Estate/Fundamentals/my_weirddup.c index e69de29..7f6f815 100644 --- a/Digby_Real_Estate/Fundamentals/my_weirddup.c +++ b/Digby_Real_Estate/Fundamentals/my_weirddup.c @@ -0,0 +1,50 @@ +#include +#include + +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")); + +} diff --git a/Digby_Real_Estate/Fundamentals/test b/Digby_Real_Estate/Fundamentals/test new file mode 100755 index 0000000..7a00858 Binary files /dev/null and b/Digby_Real_Estate/Fundamentals/test differ