for my program I need to add char(char) to string(char *) without using standard library or IO functions. For example:
char *s = "This is GOO";
char c = 'D';
s = append(s, c);
and s would produce string "This is GOOD". Is there some proper way to manipulate arrays in order to achieve this? Also it would be sufficient to produce string out of number of characters. I'm pretty sure I can use malloc, not positive though...
char * app(char* s, char c){
char *copy;
int l = strlen_(s);
copy = malloc(l+1);
copy = s;
copy[l] = c;
copy[l+1] = '\0';
return copy;
}
can't use strcpy