:3 #ifndef STRING_XLEEK_H #define STRING_XLEEK_H #include #include typedef struct string { char* str; int lenght; } string; void string_init(string* s) { s->lenght = 0; s->str = malloc(1 * sizeof(char)); s->str[0] = '\0'; } void string_free(string* s) { free(s->str); s->lenght = 0; } void string_set(string* s, const char* c) { if(s->lenght > 0) free(s->str); s->lenght = strlen(c); s->str = malloc(s->lenght * sizeof(char) + 1); strcpy(s->str, c); } void string_apps(string* s, string* o) { int last = s->lenght; s->lenght += o->lenght; s->str = realloc(s->str, s->lenght * sizeof(char) + 1); strcpy(s->str + last, o->str); } void string_appc(string* s, const char* o) { string so; string_set(&so, o); string_apps(s, &so); } #endif