Ad

A Code to combine a string and integer. Where W is result.

Code
Diff
  • #include <string.h>
    #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 <string.h>
    • #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;}