I want to replace a character by two characters in my string.
void strqclean(const char *buffer)
{
char *p = strchr(buffer,'?');
if (p != NULL)
*p = '\n';
}
int main(){
char **quest;
quest = malloc(10 * (sizeof(char*)));
quest[0] = strdup("Hello ?");
strqclean(quest[0]);
printf(quest[0]);
return;
}
This works fine, but in fact I want to replace my "?" by "?\n". strcat doesn't works with pointers is that right ? I can find a solution adding a character in my string and replace it by '\n', but that's not what I really want.
Thanks !