Ad
Code
Diff
  • #include <stdlib.h>
    char *fanis(char* r, int k) {
        char* w = malloc(strlen(r) + 1);
        if (w != NULL) {
            char* p = w;
            while (*r) { *p++ = k + *r++;}
            *p = '\0'; w = realloc(w, strlen(w) + 1);}return w;}
    
    
    • #include <stdlib.h>
    • char *fanis(char* r, int k) {
    • char* w = malloc(0);
    • int i = 0;
    • if (w != NULL)
    • for (; *r; *w++ = k + *r++)
    • i++;
    • return w - i;
    • }
    • char* w = malloc(strlen(r) + 1);
    • if (w != NULL) {
    • char* p = w;
    • while (*r) { *p++ = k + *r++;}
    • *p = '\0'; w = realloc(w, strlen(w) + 1);}return w;}