I have to pass a string to a function that strcats something to it, in K&R I read to pass a pointer to it, but I don't know where to allocate buffer...
Is there a difference betw passing an empty string or not?
My printf starts with some strange symbols, and then the string...
int main() {
char *string;
//here or in string_concat? or both?
string = (char*) malloc(16 * sizeof(char));
string_concat( &string );
printf("%s", string);
return 0;
}
void string_concat( char **string ) {
//write in string something, need a realloc?
strcat(*string, something);
}