c remove line breaks from string code example Example: how to remove \n from a string c str[strcspn(str, "\n")] = 0;