In this code, I want to remove the newline. It means whenever I print this variable, it should give me a string without a newline but instead, the comma should replace it. I can directly add a comma when declaring but I want a separate result.
Expecting output
This,is,a,simple,sentence
Code
#include <stdio.h>
#include <string.h>
int main(){
char str[] = "This\nis\na\nsimple\nsentence";
printf("%s\n", str);
}